]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: don't use deprecated -no-kvm-pit-reinjection
authorJán Tomko <jtomko@redhat.com>
Mon, 1 Jul 2013 16:28:50 +0000 (18:28 +0200)
committerJán Tomko <jtomko@redhat.com>
Tue, 5 Nov 2013 15:04:06 +0000 (16:04 +0100)
Since qemu-kvm 1.1 [1] (since 1.3. in upstream QEMU [2])
'-no-kvm-pit-reinjection' has been deprecated.
Use -global kvm-pit.lost_tick_policy=discard instead.

https://bugzilla.redhat.com/show_bug.cgi?id=978719

[1] http://git.kernel.org/cgit/virt/kvm/qemu-kvm.git/commit/?id=4e4fa39
[2] http://git.qemu.org/?p=qemu.git;a=commitdiff;h=c21fb4f

20 files changed:
src/qemu/qemu_capabilities.c
src/qemu/qemu_capabilities.h
src/qemu/qemu_command.c
tests/qemucapabilitiesdata/caps_1.2.2-1.caps
tests/qemucapabilitiesdata/caps_1.2.2-1.replies
tests/qemucapabilitiesdata/caps_1.3.1-1.caps
tests/qemucapabilitiesdata/caps_1.3.1-1.replies
tests/qemucapabilitiesdata/caps_1.4.2-1.caps
tests/qemucapabilitiesdata/caps_1.4.2-1.replies
tests/qemucapabilitiesdata/caps_1.5.3-1.caps
tests/qemucapabilitiesdata/caps_1.5.3-1.replies
tests/qemucapabilitiesdata/caps_1.6.0-1.caps
tests/qemucapabilitiesdata/caps_1.6.0-1.replies
tests/qemucapabilitiesdata/caps_1.6.50-1.caps
tests/qemucapabilitiesdata/caps_1.6.50-1.replies
tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-delay.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-delay.xml [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c

index 17095b4c90b3755fcfce90eb8583dc1a94accc24..71a913b5075f1d233ce44d46ab056ec0358dde2c 100644 (file)
@@ -242,6 +242,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
               "usb-storage.removable",
               "virtio-mmio",
               "ich9-intel-hda",
+              "kvm-pit-lost-tick-policy",
     );
 
 struct _virQEMUCaps {
@@ -1458,6 +1459,10 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsUsbStorage[] = {
     { "removable", QEMU_CAPS_USB_STORAGE_REMOVABLE },
 };
 
+static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsKVMPit[] = {
+    { "lost_tick_policy", QEMU_CAPS_KVM_PIT_TICK_POLICY },
+};
+
 struct virQEMUCapsObjectTypeProps {
     const char *type;
     struct virQEMUCapsStringFlags *props;
@@ -1501,6 +1506,8 @@ static struct virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = {
       ARRAY_CARDINALITY(virQEMUCapsObjectPropsQ35PciHost) },
     { "usb-storage", virQEMUCapsObjectPropsUsbStorage,
       ARRAY_CARDINALITY(virQEMUCapsObjectPropsUsbStorage) },
+    { "kvm-pit", virQEMUCapsObjectPropsKVMPit,
+      ARRAY_CARDINALITY(virQEMUCapsObjectPropsKVMPit) },
 };
 
 
index f1faa761d90ff385984f15e8bf4008a8d84f3787..02d47c680b4ce24c14d1e268a57364c2e425070b 100644 (file)
@@ -197,6 +197,7 @@ enum virQEMUCapsFlags {
     QEMU_CAPS_USB_STORAGE_REMOVABLE = 156, /* usb-storage.removable */
     QEMU_CAPS_DEVICE_VIRTIO_MMIO = 157, /* -device virtio-mmio */
     QEMU_CAPS_DEVICE_ICH9_INTEL_HDA = 158, /* -device ich9-intel-hda */
+    QEMU_CAPS_KVM_PIT_TICK_POLICY = 159, /* kvm-pit.lost_tick_policy */
 
     QEMU_CAPS_LAST,                   /* this must always be the last item */
 };
index 63e235dd52c8f1dd35e9ce4699ff3011f3cd5f43..e48c9c27e4e1afbdcef9bc64689d6cabd235e003 100644 (file)
@@ -7993,11 +7993,15 @@ qemuBuildCommandLine(virConnectPtr conn,
             case VIR_DOMAIN_TIMER_TICKPOLICY_DELAY:
                 /* delay is the default if we don't have kernel
                    (-no-kvm-pit), otherwise, the default is catchup. */
-                if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_KVM_PIT))
+                if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM_PIT_TICK_POLICY))
+                    virCommandAddArgList(cmd, "-global",
+                                         "kvm-pit.lost_tick_policy=discard", NULL);
+                else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_KVM_PIT))
                     virCommandAddArg(cmd, "-no-kvm-pit-reinjection");
                 break;
             case VIR_DOMAIN_TIMER_TICKPOLICY_CATCHUP:
-                if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_KVM_PIT)) {
+                if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_KVM_PIT) ||
+                    virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM_PIT_TICK_POLICY)) {
                     /* do nothing - this is default for kvm-pit */
                 } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_TDF)) {
                     /* -tdf switches to 'catchup' with userspace pit. */
index c580c0c9f98c244c4a56cf454f1e3875f798c5b0..73a561dc74722ba7eb5f5ca0208b54652a782aee 100644 (file)
     <flag name='vnc-share-policy'/>
     <flag name='usb-storage'/>
     <flag name='usb-storage.removable'/>
+    <flag name='kvm-pit-lost-tick-policy'/>
   </qemuCaps>
index 96fe4f2ea774ea400c14281e46a4eff658f2d937..345c32bf823da8e1b96c5e78e51b80ce656fd80e 100644 (file)
     "id": "libvirt-25"
 }
 
+{
+    "return": [
+        {
+            "name": "lost_tick_policy",
+            "type": "LostTickPolicy"
+        },
+        {
+            "name": "iobase",
+            "type": "hex32"
+        }
+    ],
+    "id": "libvirt-26"
+}
+
 {
     "return": [
         {
index 02ccc09826f8c90f5a9850b3b9a94d5c5d16546e..da15d8b258b848bcc6c532cfad76e333d0f61580 100644 (file)
     <flag name='dmi-to-pci-bridge'/>
     <flag name='usb-storage'/>
     <flag name='usb-storage.removable'/>
+    <flag name='kvm-pit-lost-tick-policy'/>
   </qemuCaps>
index 1d033cbd522a826514ea8cda32d4078c866ac294..63c18da88f375fde5ad0ed0de468cd520897c9b0 100644 (file)
     "id": "libvirt-25"
 }
 
+{
+    "return": [
+        {
+            "name": "lost_tick_policy",
+            "type": "LostTickPolicy"
+        },
+        {
+            "name": "iobase",
+            "type": "hex32"
+        }
+    ],
+    "id": "libvirt-26"
+}
+
 {
     "return": [
         {
index 08e9c207f93a8e4a84e67e38729fdd98f7d429b8..c419068a99c078c6f09a411c542805524477a465 100644 (file)
     <flag name='usb-storage'/>
     <flag name='usb-storage.removable'/>
     <flag name='ich9-intel-hda'/>
+    <flag name='kvm-pit-lost-tick-policy'/>
   </qemuCaps>
index bcf202c4a06699df81614b51a1e0f28e23c9b5e0..4fb40617566eb1a6137f8b0ebea332bbfd547376 100644 (file)
     "id": "libvirt-25"
 }
 
+{
+    "return": [
+        {
+            "name": "lost_tick_policy",
+            "type": "LostTickPolicy"
+        },
+        {
+            "name": "iobase",
+            "type": "hex32"
+        }
+    ],
+    "id": "libvirt-26"
+}
+
 {
     "return": [
         {
index 323ac8291bba89119ebcf707d40ef14e96676ad8..09cf657f14efe7406706b3e16988f0e8a54e9c67 100644 (file)
     <flag name='usb-storage'/>
     <flag name='usb-storage.removable'/>
     <flag name='ich9-intel-hda'/>
+    <flag name='kvm-pit-lost-tick-policy'/>
   </qemuCaps>
index 8ff17cea4b7a7a7795bf970378205b00a3a768f9..686fa3ecd47ba5324ab625065282b8825ef2b5fb 100644 (file)
     "id": "libvirt-25"
 }
 
+{
+    "return": [
+        {
+            "name": "lost_tick_policy",
+            "type": "LostTickPolicy"
+        },
+        {
+            "name": "iobase",
+            "type": "hex32"
+        }
+    ],
+    "id": "libvirt-26"
+}
+
 {
     "return": [
         {
index 3587d456d5bee2d045bcef379955bd8b8df8b591..33ee73bec3564368b4f071b15213b3623c8bca4b 100644 (file)
     <flag name='usb-storage.removable'/>
     <flag name='virtio-mmio'/>
     <flag name='ich9-intel-hda'/>
+    <flag name='kvm-pit-lost-tick-policy'/>
   </qemuCaps>
index 1b983d09955d9c4b6d39f74ba63d60ed57d9538f..95e0c37dfdfde6ceaddfe1a823bdc3aee8bd7851 100644 (file)
     "id": "libvirt-25"
 }
 
+{
+    "return": [
+        {
+            "name": "lost_tick_policy",
+            "type": "LostTickPolicy"
+        },
+        {
+            "name": "iobase",
+            "type": "hex32"
+        }
+    ],
+    "id": "libvirt-26"
+}
+
 {
     "return": [
         {
index 0bface5b7b343213ee1627cab164bf0cfd1dd5f7..a66034a8a29a6d028cdf74f0d3eb0ac705cd00f4 100644 (file)
     <flag name='usb-storage.removable'/>
     <flag name='virtio-mmio'/>
     <flag name='ich9-intel-hda'/>
+    <flag name='kvm-pit-lost-tick-policy'/>
   </qemuCaps>
index ab78cb359a7aed704a83bd81a3ae10976d0ec34c..3ecf185942e225df528c4539fa11f23e4f81e288 100644 (file)
     "id": "libvirt-25"
 }
 
+{
+    "return": [
+        {
+            "name": "lost_tick_policy",
+            "type": "LostTickPolicy"
+        },
+        {
+            "name": "iobase",
+            "type": "hex32"
+        }
+    ],
+    "id": "libvirt-26"
+}
+
 {
     "return": [
         {
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-delay.args b/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-delay.args
new file mode 100644 (file)
index 0000000..ca5823f
--- /dev/null
@@ -0,0 +1,5 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 214 -smp 2 -nographic \
+-monitor unix:/tmp/test-monitor,server,nowait \
+-no-kvm-pit-reinjection -no-acpi -boot c -usb -hda /dev/HostVG/QEMUGuest1 \
+-net none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-delay.xml b/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-delay.xml
new file mode 100644 (file)
index 0000000..7835a1b
--- /dev/null
@@ -0,0 +1,29 @@
+<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>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'>
+    <timer name='pit' tickpolicy='delay'/>
+  </clock>
+  <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/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.args b/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.args
new file mode 100644 (file)
index 0000000..f03840f
--- /dev/null
@@ -0,0 +1,5 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 214 -smp 2 -nographic \
+-monitor unix:/tmp/test-monitor,server,nowait \
+-global kvm-pit.lost_tick_policy=discard -no-acpi -boot c -usb \
+-hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.xml b/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.xml
new file mode 100644 (file)
index 0000000..7835a1b
--- /dev/null
@@ -0,0 +1,29 @@
+<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>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'>
+    <timer name='pit' tickpolicy='delay'/>
+  </clock>
+  <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>
index b14e71384b9c8934cfcf955a1d67ee9b3d390be3..a74ac2a597e47c4294bfc28d9d1f96246a800884 100644 (file)
@@ -1103,6 +1103,11 @@ mymain(void)
             QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
             QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
 
+    DO_TEST("kvm-pit-device", QEMU_CAPS_KVM_PIT_TICK_POLICY);
+    DO_TEST("kvm-pit-delay", QEMU_CAPS_NO_KVM_PIT);
+    DO_TEST("kvm-pit-device", QEMU_CAPS_NO_KVM_PIT,
+            QEMU_CAPS_KVM_PIT_TICK_POLICY);
+
     virObjectUnref(driver.config);
     virObjectUnref(driver.caps);
     virObjectUnref(driver.xmlopt);