[PATCH 3/4] test_driver: implement virDomainSaveImageDefineXML

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

 



Updates the existing image stored in @path, in case @dxml contains valid
XML supported by the fake host.

Signed-off-by: Ilias Stamatis <stamatis.iliass@xxxxxxxxx>
---
 src/test/test_driver.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index ce32570b75..b0195ac63d 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2228,6 +2228,33 @@ testDomainRestore(virConnectPtr conn,
     return testDomainRestoreFlags(conn, path, NULL, 0);
 }

+static int
+testDomainSaveImageDefineXML(virConnectPtr conn,
+                             const char *path,
+                             const char *dxml,
+                             unsigned int flags)
+{
+    int ret = -1;
+    virDomainDefPtr def = NULL;
+    testDriverPtr privconn = conn->privateData;
+
+    virCheckFlags(VIR_DOMAIN_SAVE_RUNNING |
+                  VIR_DOMAIN_SAVE_PAUSED, -1);
+
+    if ((def = virDomainDefParseString(dxml, privconn->caps, privconn->xmlopt, NULL,
+                                       VIR_DOMAIN_DEF_PARSE_INACTIVE)) == NULL)
+        goto cleanup;
+
+    if (!testDomainSaveImageWrite(privconn, def, path))
+        goto cleanup;
+
+    ret = 0;
+
+ cleanup:
+    virDomainDefFree(def);
+    return ret;
+}
+
 static int testDomainCoreDumpWithFormat(virDomainPtr domain,
                                         const char *to,
                                         unsigned int dumpformat,
@@ -7010,6 +7037,7 @@ static virHypervisorDriver testHypervisorDriver = {
     .domainSaveFlags = testDomainSaveFlags, /* 0.9.4 */
     .domainRestore = testDomainRestore, /* 0.3.2 */
     .domainRestoreFlags = testDomainRestoreFlags, /* 0.9.4 */
+    .domainSaveImageDefineXML = testDomainSaveImageDefineXML, /* 5.4.0 */
     .domainCoreDump = testDomainCoreDump, /* 0.3.2 */
     .domainCoreDumpWithFormat = testDomainCoreDumpWithFormat, /* 1.2.3 */
     .domainSetVcpus = testDomainSetVcpus, /* 0.1.4 */
--
2.21.0

--
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]

  Powered by Linux