From: Martin Kletzander Date: Mon, 8 Oct 2012 16:51:57 +0000 (+0200) Subject: fix kvm_pv_eoi with kvmclock X-Git-Tag: v0.10.2.1~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88c7f28b5f0403256aea81e9d67d8db9775a2d65;p=thirdparty%2Flibvirt.git fix kvm_pv_eoi with kvmclock When both kvmclock and kvm_pv_eoi are configured (either disabled or enabled) libvirt will generate invalid CPU specification due to the fact that even though kvmclock causes the CPU to be specified, it doesn't set have_cpu flag to true (and the new kvm_pv_eoi as well). This patch fixes the issue and adds a test exactly for that to show that it is fixed correctly (and also to keep it that way in the future of course). (cherry picked from commit 5d692cc7143084d841de79888fc249040ff40061) --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e7bb88e697..4d69b45c26 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4263,6 +4263,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver, virBufferAsprintf(&buf, "%s,%ckvmclock", have_cpu ? "" : default_model, sign); + have_cpu = true; break; } } @@ -4277,6 +4278,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver, virBufferAsprintf(&buf, "%s,%ckvm_pv_eoi", have_cpu ? "" : default_model, sign); + have_cpu = true; } if (virBufferError(&buf)) diff --git a/tests/qemuxml2argvdata/qemuxml2argv-kvmclock+eoi-disabled.args b/tests/qemuxml2argvdata/qemuxml2argv-kvmclock+eoi-disabled.args new file mode 100644 index 0000000000..f7ade0aaa1 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-kvmclock+eoi-disabled.args @@ -0,0 +1,4 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc \ +-cpu qemu32,-kvmclock,-kvm_pv_eoi -m 214 -smp 6 -nographic -monitor \ +unix:/tmp/test-monitor,server,nowait -boot n -net none -serial \ +none -parallel none -usb diff --git a/tests/qemuxml2argvdata/qemuxml2argv-kvmclock+eoi-disabled.xml b/tests/qemuxml2argvdata/qemuxml2argv-kvmclock+eoi-disabled.xml new file mode 100644 index 0000000000..a79b09fb5a --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-kvmclock+eoi-disabled.xml @@ -0,0 +1,27 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 6 + + hvm + + + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 90dad17165..4918c866f4 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -397,6 +397,7 @@ mymain(void) DO_TEST("cpu-eoi-enabled", QEMU_CAPS_ENABLE_KVM); DO_TEST("eoi-disabled", NONE); DO_TEST("eoi-enabled", NONE); + DO_TEST("kvmclock+eoi-disabled", QEMU_CAPS_ENABLE_KVM); DO_TEST("hugepages", QEMU_CAPS_MEM_PATH); DO_TEST("disk-cdrom", NONE);