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

[libvirt] [PATCH v4 3/5] qemumonitorjsontest: add test for getting multithread compress params



From: Eli Qiao <liyong qiao intel com>

Signed-off-by: Eli Qiao <liyong qiao intel com>
Signed-off-by: ShaoHe Feng <shaohe feng intel com>
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy virtuozzo com>
---
 tests/qemumonitorjsontest.c | 53 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 1be0bee..b31df36 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1593,6 +1593,58 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockStatsInfo(const void *data)
 }
 
 static int
+testQemuMonitorJSONqemuMonitorJSONGetMigrationParameters(const void *data)
+{
+    virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+    qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+    qemuMonitorMigrationParameters compression;
+    int ret = -1;
+
+    if (!test)
+        return -1;
+
+    if (qemuMonitorTestAddItem(test, "query-migrate-parameters",
+                               "{"
+                               "    \"return\": {"
+                               "        \"decompress-threads\": 2,"
+                               "        \"compress-threads\": 8,"
+                               "        \"compress-level\": 1"
+                               "    }"
+                               "}") < 0) {
+        goto cleanup;
+    }
+
+    if (qemuMonitorJSONGetMigrationParameters(qemuMonitorTestGetMonitor(test),
+                                              &compression) < 0)
+        goto cleanup;
+
+    if (compression.level != 1) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "Invalid decompress-threads: %d, expected 1",
+                       compression.level);
+        goto cleanup;
+    }
+    if (compression.threads != 8) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "Invalid decompress-threads: %d, expected 8",
+                       compression.threads);
+        goto cleanup;
+    }
+    if (compression.dthreads != 2) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "Invalid decompress-threads: %d, expected 2",
+                       compression.dthreads);
+        goto cleanup;
+    }
+    ret = 0;
+
+ cleanup:
+    qemuMonitorTestFree(test);
+    return ret;
+}
+
+
+static int
 testQemuMonitorJSONqemuMonitorJSONGetMigrationCacheSize(const void *data)
 {
     virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
@@ -2333,6 +2385,7 @@ mymain(void)
     DO_TEST(qemuMonitorJSONGetBlockInfo);
     DO_TEST(qemuMonitorJSONGetBlockStatsInfo);
     DO_TEST(qemuMonitorJSONGetMigrationCacheSize);
+    DO_TEST(qemuMonitorJSONGetMigrationParameters);
     DO_TEST(qemuMonitorJSONGetMigrationStats);
     DO_TEST(qemuMonitorJSONGetChardevInfo);
     DO_TEST(qemuMonitorJSONSetBlockIoThrottle);
-- 
1.8.3.1


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