Wanlong Gao
2012-Feb-22 14:33 UTC
[Libguestfs] [PATCH] set-smp: only set smp value at config time
We only set smp number at config time, other than it has no effect. Also limit the number value below 255, since qemu can't support that. Below is the reproduce from https://bugzilla.redhat.com/show_bug.cgi?id=795322> # guestfish -a /dev/null > [...] > ><fs> run > ><fs> get-smp > 1 > ><fs> set-smp 4 > ><fs> get-smp > 4 > ><fs> > > Actually, we're expecting to get 1 rather than 4, because there is only one > vcpu assigned to the appliance, and it's impossible for the appliance to get 4 > virtual vcpus now.Signed-off-by: Wanlong Gao <gaowanlong at cn.fujitsu.com> --- src/guestfs.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/src/guestfs.c b/src/guestfs.c index 3607eaa..3dcdf27 100644 --- a/src/guestfs.c +++ b/src/guestfs.c @@ -794,7 +794,12 @@ guestfs__get_pgroup (guestfs_h *g) int guestfs__set_smp (guestfs_h *g, int v) { - if (v >= 1) { + if (g->state != CONFIG) + return 0; + if (v > 255) { + error (g, "Unsupported number of smp cpus: %d", v); + return -1; + } else if (v >= 1) { g->smp = v; return 0; } else { -- 1.7.9
Richard W.M. Jones
2012-Feb-23 08:45 UTC
[Libguestfs] [PATCH] set-smp: only set smp value at config time
There are some problems with this patch, but mainly see my comments on this bug: https://bugzilla.redhat.com/show_bug.cgi?id=796520 Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/