[PATCH 18/18] qemumonitorjsontest: Test qemuMonitorJSONGetMigrationCapability

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

 



And so do qemuMonitorJSONSetMigrationCapability.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tests/qemumonitorjsontest.c | 46 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 5636fb6..6e6cfaf 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1899,6 +1899,51 @@ cleanup:
 }
 
 static int
+testQemuMonitorJSONqemuMonitorJSONGetMigrationCapability(const void *data)
+{
+    virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+    qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+    int ret = -1;
+    int cap;
+    const char *reply =
+        "{"
+        "    \"return\": ["
+        "        {"
+        "            \"state\": false,"
+        "            \"capability\": \"xbzrle\""
+        "        }"
+        "    ],"
+        "    \"id\": \"libvirt-22\""
+        "}";
+
+    if (!test)
+        return -1;
+
+    if (qemuMonitorTestAddItem(test, "query-migrate-capabilities", reply) < 0 ||
+        qemuMonitorTestAddItem(test, "migrate-set-capabilities",
+                               "{\"return\":{}}") < 0)
+        goto cleanup;
+
+    cap = qemuMonitorJSONGetMigrationCapability(qemuMonitorTestGetMonitor(test),
+                                              QEMU_MONITOR_MIGRATION_CAPS_XBZRLE);
+    if (cap != 1) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "Unexpected capability: %d, expecting 1",
+                       cap);
+        goto cleanup;
+    }
+
+    if (qemuMonitorJSONSetMigrationCapability(qemuMonitorTestGetMonitor(test),
+                                              QEMU_MONITOR_MIGRATION_CAPS_XBZRLE) < 0)
+        goto cleanup;
+
+    ret = 0;
+cleanup:
+    qemuMonitorTestFree(test);
+    return ret;
+}
+
+static int
 mymain(void)
 {
     int ret = 0;
@@ -1993,6 +2038,7 @@ mymain(void)
     DO_TEST(qemuMonitorJSONSendKey);
     DO_TEST(qemuMonitorJSONSetBlockIoThrottle);
     DO_TEST(qemuMonitorJSONGetTargetArch);
+    DO_TEST(qemuMonitorJSONGetMigrationCapability);
 
     virObjectUnref(xmlopt);
 
-- 
1.8.1.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]