]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuhotplugtest: Switch to -blockdev mode
authorPeter Krempa <pkrempa@redhat.com>
Thu, 21 Jul 2022 12:33:06 +0000 (14:33 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 11 Aug 2022 13:22:14 +0000 (15:22 +0200)
Enable blockdev mode and convert the expected commands to the modern
equivalents in preparation for removing the old-style hotplug code
paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
14 files changed:
tests/qemuhotplugtest.c
tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml
tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml
tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml
tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml
tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-scsi.xml
tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-usb.xml
tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-multipath.xml
tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml
tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml
tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml
tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml
tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml

index 6275799e96d7563a3c2afbd7f215fd754c7ba2bc..3e7f72b9d56a0155e3a71f586964aad78915563e 100644 (file)
@@ -73,6 +73,7 @@ qemuHotplugCreateObjects(virDomainXMLOption *xmlopt,
 
     virQEMUCapsInitQMPBasicArch(priv->qemuCaps);
 
+    virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
     virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_VIRTIO_SCSI);
     virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_USB_STORAGE);
     virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_CCW);
@@ -668,7 +669,6 @@ mymain(void)
 
 
 #define QMP_OK      "{\"return\": {}}"
-#define HMP(msg)    "{\"return\": \"" msg "\"}"
 
 #define QMP_DEVICE_DELETED(dev) \
     "{" \
@@ -705,31 +705,37 @@ mymain(void)
                    "chardev-remove", QMP_OK, "query-fdsets", "{\"return\": []}");
 
     DO_TEST_ATTACH("base-live", "disk-virtio", false, true,
-                   "human-monitor-command", HMP("OK\\r\\n"),
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
                    "device_add", QMP_OK);
     DO_TEST_DETACH("base-live", "disk-virtio", true, true,
                    "device_del", QMP_OK);
     DO_TEST_DETACH("base-live", "disk-virtio", false, false,
                    "device_del", QMP_DEVICE_DELETED("virtio-disk4") QMP_OK,
-                   "human-monitor-command", HMP(""));
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK);
 
     DO_TEST_ATTACH("base-live", "disk-usb", false, true,
-                   "human-monitor-command", HMP("OK\\r\\n"),
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
                    "device_add", QMP_OK);
     DO_TEST_DETACH("base-live", "disk-usb", true, true,
                    "device_del", QMP_OK);
     DO_TEST_DETACH("base-live", "disk-usb", false, false,
                    "device_del", QMP_DEVICE_DELETED("usb-disk16") QMP_OK,
-                   "human-monitor-command", HMP(""));
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK);
 
     DO_TEST_ATTACH("base-live", "disk-scsi", false, true,
-                   "human-monitor-command", HMP("OK\\r\\n"),
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
                    "device_add", QMP_OK);
     DO_TEST_DETACH("base-live", "disk-scsi", true, true,
                    "device_del", QMP_OK);
     DO_TEST_DETACH("base-live", "disk-scsi", false, false,
                    "device_del", QMP_DEVICE_DELETED("scsi0-0-0-5") QMP_OK,
-                   "human-monitor-command", HMP(""));
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK);
 
     DO_TEST_ATTACH("base-without-scsi-controller-live", "disk-scsi-2", false, true,
                    /* Four controllers added */
@@ -737,24 +743,27 @@ mymain(void)
                    "device_add", QMP_OK,
                    "device_add", QMP_OK,
                    "device_add", QMP_OK,
-                   "human-monitor-command", HMP("OK\\r\\n"),
-                   /* Disk added */
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
                    "device_add", QMP_OK);
     DO_TEST_DETACH("base-with-scsi-controller-live", "disk-scsi-2", true, true,
                    "device_del", QMP_OK);
     DO_TEST_DETACH("base-with-scsi-controller-live", "disk-scsi-2", false, false,
                    "device_del", QMP_DEVICE_DELETED("scsi3-0-5-6") QMP_OK,
-                   "human-monitor-command", HMP(""));
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK);
 
     DO_TEST_ATTACH("base-live", "disk-scsi-multipath", false, true,
                    "object-add", QMP_OK,
-                   "human-monitor-command", HMP("OK\\r\\n"),
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
                    "device_add", QMP_OK);
     DO_TEST_DETACH("base-live", "disk-scsi-multipath", true, true,
                    "device_del", QMP_OK);
     DO_TEST_DETACH("base-live", "disk-scsi-multipath", false, false,
                    "device_del", QMP_DEVICE_DELETED("scsi0-0-0-0") QMP_OK,
-                   "human-monitor-command", HMP(""),
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK,
                    "object-del", QMP_OK);
 
     DO_TEST_ATTACH("base-live", "qemu-agent", false, true,
@@ -766,39 +775,46 @@ mymain(void)
                    "chardev-remove", QMP_OK, "query-fdsets", "{\"return\": []}");
 
     DO_TEST_ATTACH("base-ccw-live", "ccw-virtio", false, true,
-                   "human-monitor-command", HMP("OK\\r\\n"),
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
                    "device_add", QMP_OK);
     DO_TEST_DETACH("base-ccw-live", "ccw-virtio", false, false,
                    "device_del", QMP_DEVICE_DELETED("virtio-disk4") QMP_OK,
-                   "human-monitor-command", HMP(""));
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK);
 
     DO_TEST_ATTACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2", false, true,
-                   "human-monitor-command", HMP("OK\\r\\n"),
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
                    "device_add", QMP_OK);
 
     DO_TEST_DETACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2", false, false,
                    "device_del", QMP_DEVICE_DELETED("virtio-disk0") QMP_OK,
-                   "human-monitor-command", HMP(""));
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK);
 
     DO_TEST_ATTACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2-explicit", false, true,
-                   "human-monitor-command", HMP("OK\\r\\n"),
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
                    "device_add", QMP_OK);
 
     DO_TEST_DETACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2-explicit", false, false,
                    "device_del", QMP_DEVICE_DELETED("virtio-disk0") QMP_OK,
-                   "human-monitor-command", HMP(""));
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK);
 
     /* Attach a second device, then detach the first one. Then attach the first one again. */
     DO_TEST_ATTACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2-explicit", false, true,
-                   "human-monitor-command", HMP("OK\\r\\n"),
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
                    "device_add", QMP_OK);
 
     DO_TEST_DETACH("base-ccw-live-with-2-ccw-virtio", "ccw-virtio-1-explicit", false, true,
-                   "device_del", QMP_DEVICE_DELETED("virtio-disk4") QMP_OK,
-                   "human-monitor-command", HMP(""));
+                   "device_del", QMP_DEVICE_DELETED("virtio-disk4") QMP_OK);
 
     DO_TEST_ATTACH("base-ccw-live-with-2-ccw-virtio", "ccw-virtio-1-reverse", false, false,
-                   "human-monitor-command", HMP("OK\\r\\n"),
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
                    "device_add", QMP_OK);
 
     DO_TEST_ATTACH("base-live", "ivshmem-plain", false, true,
@@ -815,7 +831,8 @@ mymain(void)
                    "object-del", QMP_OK);
     DO_TEST_ATTACH("base-live+disk-scsi-wwn",
                    "disk-scsi-duplicate-wwn", false, false,
-                   "human-monitor-command", HMP("OK\\r\\n"),
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
                    "device_add", QMP_OK);
 
     DO_TEST_ATTACH("base-live", "hostdev-pci", false, true,
@@ -859,22 +876,26 @@ mymain(void)
                    "netdev_del", QMP_OK);
 
     DO_TEST_ATTACH("base-live", "cdrom-usb", false, true,
-                   "human-monitor-command", HMP("OK\\r\\n"),
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
                    "device_add", QMP_OK);
     DO_TEST_DETACH("base-live", "cdrom-usb", true, true,
                    "device_del", QMP_OK);
     DO_TEST_DETACH("base-live", "cdrom-usb", false, false,
                    "device_del", QMP_DEVICE_DELETED("usb-disk4") QMP_OK,
-                   "human-monitor-command", HMP(""));
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK);
 
     DO_TEST_ATTACH("base-live", "cdrom-scsi", false, true,
-                   "human-monitor-command", HMP("OK\\r\\n"),
+                   "blockdev-add", QMP_OK,
+                   "blockdev-add", QMP_OK,
                    "device_add", QMP_OK);
     DO_TEST_DETACH("base-live", "cdrom-scsi", true, true,
                    "device_del", QMP_OK);
     DO_TEST_DETACH("base-live", "cdrom-scsi", false, false,
                    "device_del", QMP_DEVICE_DELETED("scsi0-0-0-4") QMP_OK,
-                   "human-monitor-command", HMP(""));
+                   "blockdev-del", QMP_OK,
+                   "blockdev-del", QMP_OK);
 
 #define DO_TEST_CPU_GROUP(prefix, vcpus, modernhp, expectfail) \
     do { \
index a786d0318553cc958dfa814cb7c823d673cc87d0..4036adde89e3a29d5c41424351512ee178fd540c 100644 (file)
@@ -21,7 +21,7 @@
     <emulator>/usr/bin/qemu-system-s390x</emulator>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw' cache='none'/>
-      <source file='/dev/null'/>
+      <source file='/dev/null' index='1'/>
       <backingStore/>
       <target dev='vde' bus='virtio'/>
       <readonly/>
index e048d2c23a9a1e1c3ce572395ac9f9cdbc666355..2eb7f9eb0ebc6a358f2919f57820e539f44bc3dc 100644 (file)
@@ -21,7 +21,7 @@
     <emulator>/usr/bin/qemu-system-s390x</emulator>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw' cache='none'/>
-      <source file='/dev/null'/>
+      <source file='/dev/null' index='1'/>
       <backingStore/>
       <target dev='hda' bus='virtio'/>
       <readonly/>
@@ -31,7 +31,7 @@
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw' cache='none'/>
-      <source file='/dev/null'/>
+      <source file='/dev/null' index='2'/>
       <backingStore/>
       <target dev='hdb' bus='virtio'/>
       <readonly/>
index fcf5bfadcba65d902b03f7a1e04bd11f5f39edf0..935925bdbafb78f8eb8e1b7567ee6b82558987f0 100644 (file)
@@ -21,7 +21,7 @@
     <emulator>/usr/bin/qemu-system-s390x</emulator>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw' cache='none'/>
-      <source file='/dev/null'/>
+      <source file='/dev/null' index='1'/>
       <backingStore/>
       <target dev='hda' bus='virtio'/>
       <readonly/>
index 8e7f479967fc1dfb9c99182ccebd8bbc5f3f100a..51fe4b461a0fca2b40475b60721a8226b52b4296 100644 (file)
@@ -21,7 +21,7 @@
     <emulator>/usr/bin/qemu-system-s390x</emulator>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw' cache='none'/>
-      <source file='/dev/null'/>
+      <source file='/dev/null' index='1'/>
       <backingStore/>
       <target dev='hda' bus='virtio'/>
       <readonly/>
index 8e7f479967fc1dfb9c99182ccebd8bbc5f3f100a..51fe4b461a0fca2b40475b60721a8226b52b4296 100644 (file)
@@ -21,7 +21,7 @@
     <emulator>/usr/bin/qemu-system-s390x</emulator>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw' cache='none'/>
-      <source file='/dev/null'/>
+      <source file='/dev/null' index='1'/>
       <backingStore/>
       <target dev='hda' bus='virtio'/>
       <readonly/>
index c3242a582f01d59bcbaa98d7c27c60e730ff0980..922e9c1b4ee8be37dcc7b7e470942edabaa2201e 100644 (file)
@@ -21,7 +21,7 @@
     <emulator>/usr/bin/qemu-system-x86_64</emulator>
     <disk type='file' device='cdrom'>
       <driver name='qemu' type='raw' cache='none'/>
-      <source file='/dev/null'/>
+      <source file='/dev/null' index='1'/>
       <backingStore/>
       <target dev='sde' bus='scsi'/>
       <readonly/>
index 89317f5dc83103dce25d4352fa0e817b01e9eb34..ba8ce3b2c8f8a439e21a52dd57db855f81d09d86 100644 (file)
@@ -21,7 +21,7 @@
     <emulator>/usr/bin/qemu-system-x86_64</emulator>
     <disk type='file' device='cdrom'>
       <driver name='qemu' type='raw' cache='none'/>
-      <source file='/dev/null'/>
+      <source file='/dev/null' index='1'/>
       <backingStore/>
       <target dev='sde' bus='usb'/>
       <readonly/>
index caf1c06c2f8fa1c3c830e155f8950f9dbe69303d..c43e023495825e35631a5b2e1b88110c186ac32f 100644 (file)
@@ -21,7 +21,7 @@
     <emulator>/usr/bin/qemu-system-x86_64</emulator>
     <disk type='block' device='lun'>
       <driver name='qemu' type='raw'/>
-      <source dev='/dev/mapper/virt'>
+      <source dev='/dev/mapper/virt' index='1'>
         <reservations managed='yes'>
           <source type='unix' path='/tmp/lib/domain-7-hotplug/pr-helper0.sock' mode='client'/>
         </reservations>
index ba99d0c2e4c8bf089c019716a533c5eca33a59fc..b3089b2006bcadc41317b2d70781fb43d9a6cfec 100644 (file)
@@ -32,7 +32,7 @@
     </disk>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw' cache='none'/>
-      <source file='/dev/null'/>
+      <source file='/dev/null' index='1'/>
       <backingStore/>
       <target dev='sdg' bus='scsi'/>
       <readonly/>
index 66302b38720ddcd4fec780db9c1c2023dddabedd..4241b3b71a2367cafc68c80e3681a9e3d5cec16b 100644 (file)
@@ -21,7 +21,7 @@
     <emulator>/usr/bin/qemu-system-x86_64</emulator>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw' cache='none'/>
-      <source file='/dev/null'/>
+      <source file='/dev/null' index='1'/>
       <backingStore/>
       <target dev='sdf' bus='scsi'/>
       <readonly/>
index b462ad48e4712470d17e46a71ba810e891b6894c..4202ded5b346254ecd758681b912286021726060 100644 (file)
@@ -21,7 +21,7 @@
     <emulator>/usr/bin/qemu-system-x86_64</emulator>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw' cache='none'/>
-      <source file='/dev/null'/>
+      <source file='/dev/null' index='1'/>
       <backingStore/>
       <target dev='sdq' bus='usb'/>
       <readonly/>
index af68d7fc6e94183228e23d880d4e2d9bcb3c0966..02851d4ca1b1ed1a73ae2b89411a4b3b57832b84 100644 (file)
@@ -21,7 +21,7 @@
     <emulator>/usr/bin/qemu-system-x86_64</emulator>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw' cache='none'/>
-      <source file='/dev/null'/>
+      <source file='/dev/null' index='1'/>
       <backingStore/>
       <target dev='vde' bus='virtio'/>
       <readonly/>
index ddc57cbb16e4817373b67afdcaf953ca29e28887..71dd10d40d31ba8a104aa8f7644562163c8a8187 100644 (file)
@@ -21,7 +21,7 @@
     <emulator>/usr/bin/qemu-system-x86_64</emulator>
     <disk type='file' device='disk'>
       <driver name='qemu' type='raw' cache='none'/>
-      <source file='/dev/null'/>
+      <source file='/dev/null' index='1'/>
       <backingStore/>
       <target dev='sdf' bus='scsi'/>
       <readonly/>