]> xenbits.xensource.com Git - people/dariof/libvirt.git/commitdiff
qemuagenttest: Test the filesystem trimming
authorPeter Krempa <pkrempa@redhat.com>
Mon, 29 Jul 2013 09:02:19 +0000 (11:02 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 31 Jul 2013 12:25:43 +0000 (14:25 +0200)
tests/qemuagenttest.c

index 7f22ff04fc905adf3245f39fa66cb04653b345d3..a3b8834d78c3830d10bf042add11c2c12d022a00 100644 (file)
@@ -131,6 +131,36 @@ cleanup:
 }
 
 
+static int
+testQemuAgentFSTrim(const void *data)
+{
+    virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+    qemuMonitorTestPtr test = qemuMonitorTestNewAgent(xmlopt);
+    int ret = -1;
+
+    if (!test)
+        return -1;
+
+    if (qemuMonitorTestAddAgentSyncResponse(test) < 0)
+        goto cleanup;
+
+    if (qemuMonitorTestAddItemParams(test, "guest-fstrim",
+                                     "{ \"return\" : {} }",
+                                     "minimum", "1337",
+                                     NULL) < 0)
+        goto cleanup;
+
+    if (qemuAgentFSTrim(qemuMonitorTestGetAgent(test), 1337) < 0)
+        goto cleanup;
+
+    ret = 0;
+
+cleanup:
+    qemuMonitorTestFree(test);
+    return ret;
+}
+
+
 static int
 mymain(void)
 {
@@ -154,6 +184,7 @@ mymain(void)
 
     DO_TEST(FSFreeze);
     DO_TEST(FSThaw);
+    DO_TEST(FSTrim);
 
     virObjectUnref(xmlopt);