From b02fd24f18fae70d2599e594df724fa9e497bb1f Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Fri, 26 Jul 2013 15:28:33 +0200 Subject: [PATCH] qemuhotplugtest: Add tests for virtio SCSI disk hotplug --- tests/qemuhotplugtest.c | 18 ++++++++ .../qemuhotplug-disk-scsi.xml | 7 +++ .../qemuhotplug-hotplug-base+disk-scsi.xml | 46 +++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-disk-scsi.xml create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-hotplug-base+disk-scsi.xml diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index a916bf6a7e..30e9dcbbae 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -79,6 +79,7 @@ qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt, virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DRIVE); virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE); virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_NET_NAME); + virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_VIRTIO_SCSI); if (event) virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_DEL_EVENT); @@ -459,6 +460,23 @@ mymain(void) "device_del", QMP_DEVICE_DELETED("usb-disk16") QMP_OK, "human-monitor-command", HMP("")); + DO_TEST_ATTACH("hotplug-base", "disk-scsi", false, true, + "human-monitor-command", HMP("OK\\r\\n"), + "device_add", QMP_OK); + DO_TEST_DETACH("hotplug-base", "disk-scsi", false, false, + "device_del", QMP_OK, + "human-monitor-command", HMP("")); + + DO_TEST_ATTACH_EVENT("hotplug-base", "disk-scsi", false, true, + "human-monitor-command", HMP("OK\\r\\n"), + "device_add", QMP_OK); + DO_TEST_DETACH("hotplug-base", "disk-scsi", true, true, + "device_del", QMP_OK, + "human-monitor-command", HMP("")); + DO_TEST_DETACH("hotplug-base", "disk-scsi", false, false, + "device_del", QMP_DEVICE_DELETED("scsi0-0-0-5") QMP_OK, + "human-monitor-command", HMP("")); + virObjectUnref(driver.caps); virObjectUnref(driver.xmlopt); virObjectUnref(driver.config); diff --git a/tests/qemuhotplugtestdata/qemuhotplug-disk-scsi.xml b/tests/qemuhotplugtestdata/qemuhotplug-disk-scsi.xml new file mode 100644 index 0000000000..5be72b7e07 --- /dev/null +++ b/tests/qemuhotplugtestdata/qemuhotplug-disk-scsi.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/qemuhotplugtestdata/qemuhotplug-hotplug-base+disk-scsi.xml b/tests/qemuhotplugtestdata/qemuhotplug-hotplug-base+disk-scsi.xml new file mode 100644 index 0000000000..a06158b8ff --- /dev/null +++ b/tests/qemuhotplugtestdata/qemuhotplug-hotplug-base+disk-scsi.xml @@ -0,0 +1,46 @@ + + hotplug + d091ea82-29e6-2e34-3005-f02617b36e87 + 4194304 + 4194304 + 4 + + hvm + + + + + + + + + destroy + restart + restart + + /usr/libexec/qemu-kvm + + + + + + +
+ + +
+ + +
+ + +
+ + + +
+ + + + +