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(a)redhat.com>
---
tests/qemuhotplugtest.c | 75 ++++++++++++-------
.../qemuhotplug-base-ccw-live+ccw-virtio.xml | 2 +-
...with-2-ccw-virtio+ccw-virtio-1-reverse.xml | 4 +-
...otplug-base-ccw-live-with-2-ccw-virtio.xml | 2 +-
...-with-ccw-virtio+ccw-virtio-2-explicit.xml | 2 +-
...-ccw-live-with-ccw-virtio+ccw-virtio-2.xml | 2 +-
.../qemuhotplug-base-live+cdrom-scsi.xml | 2 +-
.../qemuhotplug-base-live+cdrom-usb.xml | 2 +-
...uhotplug-base-live+disk-scsi-multipath.xml | 2 +-
...+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml | 2 +-
.../qemuhotplug-base-live+disk-scsi.xml | 2 +-
.../qemuhotplug-base-live+disk-usb.xml | 2 +-
.../qemuhotplug-base-live+disk-virtio.xml | 2 +-
...thout-scsi-controller-live+disk-scsi-2.xml | 2 +-
14 files changed, 62 insertions(+), 41 deletions(-)
diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index c938c8dc4c..5edcf3d989 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -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);
@@ -670,7 +671,6 @@ mymain(void)
#define QMP_OK "{\"return\": {}}"
-#define HMP(msg) "{\"return\": \"" msg "\"}"
#define QMP_DEVICE_DELETED(dev) \
"{" \
@@ -707,31 +707,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 */
@@ -739,24 +745,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,
@@ -768,39 +777,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,
@@ -817,7 +833,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,
@@ -861,22 +878,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 { \
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
index a786d03185..4036adde89 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
@@ -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/>
diff --git
a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml
b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml
index e048d2c23a..2eb7f9eb0e 100644
---
a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml
+++
b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml
@@ -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/>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml
b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml
index fcf5bfadcb..935925bdba 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml
@@ -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/>
diff --git
a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml
b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml
index 8e7f479967..51fe4b461a 100644
---
a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml
+++
b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml
@@ -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/>
diff --git
a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml
b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml
index 8e7f479967..51fe4b461a 100644
---
a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml
+++
b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml
@@ -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/>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-scsi.xml
b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-scsi.xml
index c3242a582f..922e9c1b4e 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-scsi.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-scsi.xml
@@ -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/>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-usb.xml
b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-usb.xml
index 89317f5dc8..ba8ce3b2c8 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-usb.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+cdrom-usb.xml
@@ -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/>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-multipath.xml
b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-multipath.xml
index caf1c06c2f..c43e023495 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-multipath.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-multipath.xml
@@ -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>
diff --git
a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml
b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml
index ba99d0c2e4..b3089b2006 100644
---
a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml
+++
b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml
@@ -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/>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml
b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml
index 66302b3872..4241b3b71a 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml
@@ -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/>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml
b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml
index b462ad48e4..4202ded5b3 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml
@@ -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/>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml
b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml
index af68d7fc6e..02851d4ca1 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml
@@ -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/>
diff --git
a/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml
b/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml
index ddc57cbb16..71dd10d40d 100644
---
a/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml
+++
b/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml
@@ -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/>
--
2.36.1