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

Re: [libvirt] [PATCH 4/7] qemu: Implement qemuDomainManagedSaveDefineXML





On 06/21/2017 01:02 PM, Peter Krempa wrote:
On Wed, Jun 21, 2017 at 05:07:49 +0530, Kothapally Madhu Pavan wrote:
This commit adds qemu driver implementation to edit xml
configuration of managed save state file of a domain.

Signed-off-by: Kothapally Madhu Pavan <kmp linux vnet ibm com>
---
 src/qemu/qemu_driver.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c9b3ef3..7ce6464 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6837,6 +6837,43 @@ qemuDomainManagedSaveGetXMLDesc(virDomainPtr dom, unsigned int flags)
     return ret;
 }
 
+static int
+qemuDomainManagedSaveDefineXML(virDomainPtr dom, const char *dxml,
+                               unsigned int flags)
+{
+    virQEMUDriverPtr driver = dom->conn->privateData;
+    virConnectPtr conn = dom->conn;
+    virDomainObjPtr vm;
+    char *path = NULL;
+
+    if (!(vm = qemuDomObjFromDomain(dom)))
+        return -1;
+
+    path = qemuDomainManagedSavePath(driver, vm);
+    if (!path)
+        goto error;
+
+    virDomainObjEndAPI(&vm);
+
+    if (conn->driver->domainSaveImageDefineXML) {
+        int ret;
+        ret = qemuDomainSaveImageDefineXML(conn, path, dxml, flags);
+
+        VIR_FREE(path);
+
+        if (ret < 0)
+            goto error;
+        return ret;
+    }
This implementation is horrible. Please call the qemu implementation
directly or extract useful parts rather than going through the driver
pointers.
I was trying to follow the pattern of other APIs and I didn't realize the pointers are not necessary. Thanks for the comments. Fixing that in the next version.

    


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