summaryrefslogtreecommitdiffstats
path: root/rescue
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-09-28 14:39:31 +0100
committerRichard W.M. Jones <rjones@redhat.com>2011-09-28 14:52:56 +0100
commit04fbcc63ebf5718608f199eb6b09061cd32283c3 (patch)
tree1df1bb78ce7df4f9363ca8ca41e567026aea2d8a /rescue
parent8403f5a9d8f1451e2c2b029b51bac18724b18ebf (diff)
downloadlibguestfs-04fbcc63ebf5718608f199eb6b09061cd32283c3.tar.gz
libguestfs-04fbcc63ebf5718608f199eb6b09061cd32283c3.tar.xz
libguestfs-04fbcc63ebf5718608f199eb6b09061cd32283c3.zip
New API: set-smp, get-smp
These calls allow you to change the number of virtual CPUs assigned to the appliance. This also adds a --smp option to virt-rescue.
Diffstat (limited to 'rescue')
-rw-r--r--rescue/virt-rescue.c16
-rwxr-xr-xrescue/virt-rescue.pod4
2 files changed, 20 insertions, 0 deletions
diff --git a/rescue/virt-rescue.c b/rescue/virt-rescue.c
index 7c8a57b3..7ad39b5b 100644
--- a/rescue/virt-rescue.c
+++ b/rescue/virt-rescue.c
@@ -77,6 +77,7 @@ usage (int status)
" --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"
@@ -115,6 +116,7 @@ main (int argc, char *argv[])
{ "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 }
@@ -128,6 +130,7 @@ main (int argc, char *argv[])
const char *append = NULL;
char *append_full;
int memsize = 0;
+ int smp = 0;
g = guestfs_create ();
if (g == NULL) {
@@ -154,6 +157,17 @@ main (int argc, char *argv[])
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);
@@ -270,6 +284,8 @@ main (int argc, char *argv[])
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.
diff --git a/rescue/virt-rescue.pod b/rescue/virt-rescue.pod
index 81a24cfe..e25b6edd 100755
--- a/rescue/virt-rescue.pod
+++ b/rescue/virt-rescue.pod
@@ -175,6 +175,10 @@ See also L<guestfish(1)/OPENING DISKS FOR READ AND WRITE>.
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>