From 2ebb44a9572cd44ab0d1bbfb580ff17e6aeee247 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 21 Jul 2022 14:33:06 +0200 Subject: [PATCH] qemuhotplugtest: Switch to -blockdev mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Pavel Hrdina Reviewed-by: Ján Tomko --- 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 6275799e96..3e7f72b9d5 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); @@ -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 { \ 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 @@ /usr/bin/qemu-system-s390x - + 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 @@ /usr/bin/qemu-system-s390x - + @@ -31,7 +31,7 @@ - + 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 @@ /usr/bin/qemu-system-s390x - + 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 @@ /usr/bin/qemu-system-s390x - + 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 @@ /usr/bin/qemu-system-s390x - + 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 @@ /usr/bin/qemu-system-x86_64 - + 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 @@ /usr/bin/qemu-system-x86_64 - + 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 @@ /usr/bin/qemu-system-x86_64 - + 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 @@ - + 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 @@ /usr/bin/qemu-system-x86_64 - + 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 @@ /usr/bin/qemu-system-x86_64 - + 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 @@ /usr/bin/qemu-system-x86_64 - + 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 @@ /usr/bin/qemu-system-x86_64 - + -- 2.39.5