[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 15/17] qemuhotplugtest: Add tests for async virtio disk detach



---
 tests/qemuhotplugtest.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 4901178..5e25ea9 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -389,6 +389,19 @@ mymain(void)
 #define QMP_OK      "{\"return\": {}}"
 #define HMP(msg)    "{\"return\": \"" msg "\"}"
 
+#define QMP_DEVICE_DELETED(dev) \
+    "{"                                                     \
+    "    \"timestamp\": {"                                  \
+    "        \"seconds\": 1374137171,"                      \
+    "        \"microseconds\": 2659"                        \
+    "    },"                                                \
+    "    \"event\": \"DEVICE_DELETED\","                    \
+    "    \"data\": {"                                       \
+    "        \"device\": \"" dev "\","                      \
+    "        \"path\": \"/machine/peripheral/" dev "\""     \
+    "    }"                                                 \
+    "}\r\n"
+
     DO_TEST_UPDATE("graphics-spice", "graphics-spice-nochange", false, false, NULL);
     DO_TEST_UPDATE("graphics-spice-timeout", "graphics-spice-timeout-nochange", false, false,
                    "set_password", QMP_OK, "expire_password", QMP_OK);
@@ -415,6 +428,16 @@ mymain(void)
                    "device_del", QMP_OK,
                    "human-monitor-command", HMP(""));
 
+    DO_TEST_ATTACH_EVENT("hotplug-base", "disk-virtio", false, true,
+                         "human-monitor-command", HMP("OK\\r\\n"),
+                         "device_add", QMP_OK);
+    DO_TEST_DETACH("hotplug-base", "disk-virtio", true, true,
+                   "device_del", QMP_OK,
+                   "human-monitor-command", HMP(""));
+    DO_TEST_DETACH("hotplug-base", "disk-virtio", false, false,
+                   "device_del", QMP_DEVICE_DELETED("virtio-disk4") QMP_OK,
+                   "human-monitor-command", HMP(""));
+
     virObjectUnref(driver.caps);
     virObjectUnref(driver.xmlopt);
     virObjectUnref(driver.config);
-- 
1.8.3.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]