From cdf4ae6ae30a9f40f275b44323528519076ef7c0 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Mon, 27 Jun 2016 16:43:48 +0200 Subject: [PATCH] tests: Add test cases for SCSI disk hot-plug with QEMU Verify that SCSI controllers get created automatically when a SCSI disk is hot-plugged to a domain that doesn't have a matching SCSI controller defined already. Reviewed-by: Boris Fiuczynski Signed-off-by: Marc Hartmayer --- tests/qemuhotplugtest.c | 29 ++++++++ .../qemuhotplug-disk-scsi-2.xml | 8 +++ ...-with-scsi-controller-live+disk-scsi-2.xml | 51 ++++++++++++++ ...thout-scsi-controller-live+disk-scsi-2.xml | 66 +++++++++++++++++++ ...hotplug-base-with-scsi-controller-live.xml | 56 ++++++++++++++++ ...plug-base-without-scsi-controller-live.xml | 40 +++++++++++ 6 files changed, 250 insertions(+) create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-disk-scsi-2.xml create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-hotplug-base-with-scsi-controller-live+disk-scsi-2.xml create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-hotplug-base-without-scsi-controller-live+disk-scsi-2.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hotplug-base-with-scsi-controller-live.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hotplug-base-without-scsi-controller-live.xml diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 91bf331c97..ae57c0af0e 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -487,6 +487,35 @@ mymain(void) "device_del", QMP_DEVICE_DELETED("scsi0-0-0-5") QMP_OK, "human-monitor-command", HMP("")); + DO_TEST_ATTACH("hotplug-base-without-scsi-controller-live", "disk-scsi-2", false, true, + /* Four controllers added */ + "device_add", QMP_OK, + "device_add", QMP_OK, + "device_add", QMP_OK, + "device_add", QMP_OK, + "human-monitor-command", HMP("OK\\r\\n"), + /* Disk added */ + "device_add", QMP_OK); + DO_TEST_DETACH("hotplug-base-with-scsi-controller-live", "disk-scsi-2", false, false, + "device_del", QMP_OK, + "human-monitor-command", HMP("")); + + DO_TEST_ATTACH_EVENT("hotplug-base-without-scsi-controller-live", "disk-scsi-2", false, true, + /* Four controllers added */ + "device_add", QMP_OK, + "device_add", QMP_OK, + "device_add", QMP_OK, + "device_add", QMP_OK, + "human-monitor-command", HMP("OK\\r\\n"), + /* Disk added */ + "device_add", QMP_OK); + DO_TEST_DETACH("hotplug-base-with-scsi-controller-live", "disk-scsi-2", true, true, + "device_del", QMP_OK, + "human-monitor-command", HMP("")); + DO_TEST_DETACH("hotplug-base-with-scsi-controller-live", "disk-scsi-2", false, false, + "device_del", QMP_DEVICE_DELETED("scsi3-0-5-7") QMP_OK, + "human-monitor-command", HMP("")); + DO_TEST_ATTACH("hotplug-base-live", "qemu-agent", false, true, "chardev-add", QMP_OK, "device_add", QMP_OK); diff --git a/tests/qemuhotplugtestdata/qemuhotplug-disk-scsi-2.xml b/tests/qemuhotplugtestdata/qemuhotplug-disk-scsi-2.xml new file mode 100644 index 0000000000..3a847fbda6 --- /dev/null +++ b/tests/qemuhotplugtestdata/qemuhotplug-disk-scsi-2.xml @@ -0,0 +1,8 @@ + + + + +
+ + + diff --git a/tests/qemuhotplugtestdata/qemuhotplug-hotplug-base-with-scsi-controller-live+disk-scsi-2.xml b/tests/qemuhotplugtestdata/qemuhotplug-hotplug-base-with-scsi-controller-live+disk-scsi-2.xml new file mode 100644 index 0000000000..b2c9a073a8 --- /dev/null +++ b/tests/qemuhotplugtestdata/qemuhotplug-hotplug-base-with-scsi-controller-live+disk-scsi-2.xml @@ -0,0 +1,51 @@ + + hotplug + d091ea82-29e6-2e34-3005-f02617b36e87 + 4194304 + 4194304 + 4 + + hvm + + + + + + + + + destroy + restart + restart + + /usr/libexec/qemu-kvm + + + + + + +
+ + +
+ + + +
+ + +
+ + +
+ + +
+ + + + + + + diff --git a/tests/qemuhotplugtestdata/qemuhotplug-hotplug-base-without-scsi-controller-live+disk-scsi-2.xml b/tests/qemuhotplugtestdata/qemuhotplug-hotplug-base-without-scsi-controller-live+disk-scsi-2.xml new file mode 100644 index 0000000000..2b11f21516 --- /dev/null +++ b/tests/qemuhotplugtestdata/qemuhotplug-hotplug-base-without-scsi-controller-live+disk-scsi-2.xml @@ -0,0 +1,66 @@ + + hotplug + d091ea82-29e6-2e34-3005-f02617b36e87 + 4194304 + 4194304 + 4 + + hvm + + + + + + + + + destroy + restart + restart + + /usr/libexec/qemu-kvm + + + + + + + + +
+ + + +
+ + + + + + +
+ + + +
+ + + +
+ + + +
+ + + + + + + + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hotplug-base-with-scsi-controller-live.xml b/tests/qemuxml2argvdata/qemuxml2argv-hotplug-base-with-scsi-controller-live.xml new file mode 100644 index 0000000000..b2ea144389 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-hotplug-base-with-scsi-controller-live.xml @@ -0,0 +1,56 @@ + + hotplug + d091ea82-29e6-2e34-3005-f02617b36e87 + 4194304 + 4194304 + 4 + + hvm + + + + + + + + + destroy + restart + restart + + /usr/libexec/qemu-kvm + + +
+ + + + + + +
+ + + +
+ + + +
+ + + +
+ + + + + + + + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hotplug-base-without-scsi-controller-live.xml b/tests/qemuxml2argvdata/qemuxml2argv-hotplug-base-without-scsi-controller-live.xml new file mode 100644 index 0000000000..66bc2af239 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-hotplug-base-without-scsi-controller-live.xml @@ -0,0 +1,40 @@ + + hotplug + d091ea82-29e6-2e34-3005-f02617b36e87 + 4194304 + 4194304 + 4 + + hvm + + + + + + + + + destroy + restart + restart + + /usr/libexec/qemu-kvm + + +
+ + + + + + + + + + + + + + + +