diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-09-28 14:39:31 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-09-28 14:52:56 +0100 |
commit | 04fbcc63ebf5718608f199eb6b09061cd32283c3 (patch) | |
tree | 1df1bb78ce7df4f9363ca8ca41e567026aea2d8a /src/guestfs.c | |
parent | 8403f5a9d8f1451e2c2b029b51bac18724b18ebf (diff) | |
download | libguestfs-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 'src/guestfs.c')
-rw-r--r-- | src/guestfs.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/guestfs.c b/src/guestfs.c index 002418a4..f7ad9674 100644 --- a/src/guestfs.c +++ b/src/guestfs.c @@ -144,6 +144,9 @@ guestfs_create (void) */ 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; @@ -814,6 +817,24 @@ guestfs__get_pgroup (guestfs_h *g) 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. |