[PATCH v2 3/3] test_driver: implement virDomainManagedSaveDefineXML

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

 



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

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 211c0d737a..a127dc69c1 100755
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -7653,6 +7653,45 @@ testDomainManagedSaveGetXMLDesc(virDomainPtr dom,
 }


+static int
+testDomainManagedSaveDefineXML(virDomainPtr dom,
+                               const char *dxml,
+                               unsigned int flags)
+{
+    virDomainObjPtr vm = NULL;
+    virDomainDefPtr newdef = NULL;
+    testDriverPtr privconn = dom->conn->privateData;
+    testDomainObjPrivatePtr privdom;
+    int ret = -1;
+
+    virCheckFlags(VIR_DOMAIN_SAVE_BYPASS_CACHE |
+                  VIR_DOMAIN_SAVE_RUNNING |
+                  VIR_DOMAIN_SAVE_PAUSED, -1);
+
+    if (!(vm = testDomObjFromDomain(dom)))
+        return -1;
+
+    if (vm->hasManagedSave == false) {
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("domain does not have managed save image"));
+        goto cleanup;
+    }
+
+    if ((newdef = virDomainDefParseString(dxml, privconn->caps, privconn->xmlopt, NULL,
+                                          VIR_DOMAIN_DEF_PARSE_INACTIVE)) == NULL)
+        goto cleanup;
+
+    privdom = vm->privateData;
+    virDomainDefFree(privdom->managedDef);
+    privdom->managedDef = newdef;
+
+    ret = 0;
+ cleanup:
+    virDomainObjEndAPI(&vm);
+    return ret;
+}
+
+
 static int
 testDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags)
 {
@@ -9118,6 +9157,7 @@ static virHypervisorDriver testHypervisorDriver = {
     .connectGetCPUModelNames = testConnectGetCPUModelNames, /* 1.1.3 */
     .domainManagedSave = testDomainManagedSave, /* 1.1.4 */
     .domainManagedSaveGetXMLDesc = testDomainManagedSaveGetXMLDesc, /* 5.7.0 */
+    .domainManagedSaveDefineXML = testDomainManagedSaveDefineXML, /* 5.7.0 */
     .domainHasManagedSaveImage = testDomainHasManagedSaveImage, /* 1.1.4 */
     .domainManagedSaveRemove = testDomainManagedSaveRemove, /* 1.1.4 */
     .domainMemoryStats = testDomainMemoryStats, /* 5.7.0 */
--
2.22.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