"\
This returns the process group flag.");
+ ("set_smp", (RErr, [Int "smp"], []), -1, [FishAlias "smp"],
+ [],
+ "set number of virtual CPUs in appliance",
+ "\
+Change the number of virtual CPUs assigned to the appliance. The
+default is C<1>. Increasing this may improve performance, though
+often it has no effect.
+
+This function must be called before C<guestfs_launch>.");
+
+ ("get_smp", (RInt "smp", [], []), -1, [],
+ [],
+ "get number of virtual CPUs in appliance",
+ "\
+This returns the number of virtual CPUs assigned to the appliance.");
+
]
(* daemon_functions are any functions which cause some action
" --network Enable network\n"
" -r|--ro Access read-only\n"
" --selinux Enable SELinux\n"
+ " --smp N Enable SMP with N >= 2 virtual CPUs\n"
" -v|--verbose Verbose messages\n"
" -V|--version Display version and exit\n"
" -w|--rw Mount read-write\n"
{ "ro", 0, 0, 'r' },
{ "rw", 0, 0, 'w' },
{ "selinux", 0, 0, 0 },
+ { "smp", 1, 0, 0 },
{ "verbose", 0, 0, 'v' },
{ "version", 0, 0, 'V' },
{ 0, 0, 0, 0 }
const char *append = NULL;
char *append_full;
int memsize = 0;
+ int smp = 0;
g = guestfs_create ();
if (g == NULL) {
format = NULL;
else
format = optarg;
+ } else if (STREQ (long_options[option_index].name, "smp")) {
+ if (sscanf (optarg, "%u", &smp) != 1) {
+ fprintf (stderr, _("%s: could not parse --smp parameter '%s'\n"),
+ program_name, optarg);
+ exit (EXIT_FAILURE);
+ }
+ if (smp < 1) {
+ fprintf (stderr, _("%s: --smp parameter '%s' should be >= 1\n"),
+ program_name, optarg);
+ exit (EXIT_FAILURE);
+ }
} else {
fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
program_name, long_options[option_index].name, option_index);
guestfs_set_memsize (g, memsize);
if (network)
guestfs_set_network (g, 1);
+ if (smp >= 1)
+ guestfs_set_smp (g, smp);
/* Kernel command line must include guestfs_rescue=1 (see
* appliance/init) as well as other options.
Enable SELinux in the rescue appliance. You should read
L<guestfs(3)/SELINUX> before using this option.
+=item B<--smp> N
+
+Enable N E<ge> 2 virtual CPUs in the rescue appliance.
+
=item B<-v>
=item B<--verbose>
int pgroup; /* Create process group for children? */
+ int smp; /* If > 1, -smp flag passed to qemu. */
+
char *last_error;
int last_errnum; /* errno, or 0 if there was no errno */
*/
g->msg_next_serial = 0x00123400;
+ /* Default is uniprocessor appliance. */
+ g->smp = 1;
+
/* Link the handles onto a global list. */
gl_lock_lock (handles_lock);
g->next = handles;
return g->pgroup;
}
+int
+guestfs__set_smp (guestfs_h *g, int v)
+{
+ if (v >= 1) {
+ g->smp = v;
+ return 0;
+ } else {
+ error (g, "invalid smp parameter: %d", v);
+ return -1;
+ }
+}
+
+int
+guestfs__get_smp (guestfs_h *g)
+{
+ return g->smp;
+}
+
/* Note the private data area is allocated lazily, since the vast
* majority of callers will never use it. This means g->pda is
* likely to be NULL.
add_cmdline (g, "-nographic");
+ if (g->smp > 1) {
+ snprintf (buf, sizeof buf, "%d", g->smp);
+ add_cmdline (g, "-smp");
+ add_cmdline (g, buf);
+ }
+
snprintf (buf, sizeof buf, "%d", g->memsize);
add_cmdline (g, "-m");
add_cmdline (g, buf);
printf ("guestfs_get_recovery_proc: %d\n",
guestfs_get_recovery_proc (g));
printf ("guestfs_get_selinux: %d\n", guestfs_get_selinux (g));
+ printf ("guestfs_get_smp: %d\n", guestfs_get_smp (g));
printf ("guestfs_get_trace: %d\n", guestfs_get_trace (g));
printf ("guestfs_get_verbose: %d\n", guestfs_get_verbose (g));