[PATCH] fixup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[To be squashed in the previous commit]

I've found two more places where shareSpecified should be checked
and added a test.

---
 src/parallels/parallels_driver.c                   |  1 +
 src/vmx/vmx.c                                      |  2 +-
 .../qemuxml2argv-cputune-zero-shares.args          |  5 ++++
 .../qemuxml2argv-cputune-zero-shares.xml           | 35 ++++++++++++++++++++++
 tests/qemuxml2argvtest.c                           |  1 +
 tests/qemuxml2xmltest.c                            |  1 +
 6 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cputune-zero-shares.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cputune-zero-shares.xml

diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 33260ef..f0c7762 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -2053,6 +2053,7 @@ parallelsApplyChanges(virConnectPtr conn, virDomainObjPtr dom, virDomainDefPtr n
     }
 
     if (old->cputune.shares != new->cputune.shares ||
+        old->cputune.sharesSpecified != new->cputune.sharesSpecified ||
         old->cputune.period != new->cputune.period ||
         old->cputune.quota != new->cputune.quota ||
         old->cputune.nvcpupin != new->cputune.nvcpupin) {
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 75dcdc6..281aae4 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -3176,7 +3176,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
     }
 
     /* def:cputune.shares -> vmx:sched.cpu.shares */
-    if (def->cputune.shares > 0) {
+    if (def->cputune.sharesSpecified) {
         /* See http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.SharesInfo.Level.html */
         if (def->cputune.shares == def->vcpus * 500) {
             virBufferAddLit(&buffer, "sched.cpu.shares = \"low\"\n");
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cputune-zero-shares.args b/tests/qemuxml2argvdata/qemuxml2argv-cputune-zero-shares.args
new file mode 100644
index 0000000..bc6d241
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cputune-zero-shares.args
@@ -0,0 +1,5 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu \
+-name QEMUGuest1 -S -M pc -m 214 -smp 2 -nographic \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
+-hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cputune-zero-shares.xml b/tests/qemuxml2argvdata/qemuxml2argv-cputune-zero-shares.xml
new file mode 100644
index 0000000..d597054
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cputune-zero-shares.xml
@@ -0,0 +1,35 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <cputune>
+    <shares>0</shares>
+    <period>1000000</period>
+    <quota>-1</quota>
+    <vcpupin vcpu='0' cpuset='0'/>
+    <vcpupin vcpu='1' cpuset='1'/>
+    <emulatorpin cpuset='1'/>
+  </cputune>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 5d6a64b..bedfbb1 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1163,6 +1163,7 @@ mymain(void)
     DO_TEST("blkiotune", QEMU_CAPS_NAME);
     DO_TEST("blkiotune-device", QEMU_CAPS_NAME);
     DO_TEST("cputune", QEMU_CAPS_NAME);
+    DO_TEST("cputune-zero-shares", QEMU_CAPS_NAME);
     DO_TEST("numatune-memory", NONE);
     DO_TEST("numatune-auto-nodeset-invalid", NONE);
     DO_TEST("numad", NONE);
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 8e8fe71..9a16289 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -260,6 +260,7 @@ mymain(void)
     DO_TEST("blkiotune");
     DO_TEST("blkiotune-device");
     DO_TEST("cputune");
+    DO_TEST("cputune-zero-shares");
 
     DO_TEST("smp");
     DO_TEST("lease");
-- 
1.8.3.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]