Re: [PATCH 3/7] qemu: Implement qemuDomainManagedSaveGetXMLDesc

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

 





On 06/21/2017 01:05 PM, Peter Krempa wrote:
On Wed, Jun 21, 2017 at 05:07:48 +0530, Kothapally Madhu Pavan wrote:
This commit adds qemu driver implementaion to get xml description
for managed save state domain.

Signed-off-by: Kothapally Madhu Pavan <kmp@xxxxxxxxxxxxxxxxxx>
---
  src/qemu/qemu_driver.c | 40 ++++++++++++++++++++++++++++++++++++++++
  1 file changed, 40 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e91663c..c9b3ef3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6798,6 +6798,45 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path,
      return ret;
  }
+static char *
+qemuDomainManagedSaveGetXMLDesc(virDomainPtr dom, unsigned int flags)
+{
+    virQEMUDriverPtr driver = dom->conn->privateData;
+    virDomainObjPtr vm;
+    char *path = NULL;
+    char *ret = NULL;
+    virDomainDefPtr def = NULL;
+    int fd = -1;
+    virQEMUSaveDataPtr data = NULL;
+
+    /* We only take subset of virDomainDefFormat flags.  */
+    virCheckFlags(VIR_DOMAIN_XML_SECURE, NULL);
+
+    if (!(vm = qemuDomObjFromDomain(dom)))
+        return ret;
+
+    path = qemuDomainManagedSavePath(driver, vm);
+
+    if (!path)
+        goto cleanup;
+
+    fd = qemuDomainSaveImageOpen(driver, path, &def, &data,
+                                 false, NULL, false, false);
+    if (fd < 0)
This will report a horrible error message in case when the VM is not
manage-saved. You need to check whether the file exists and report a
better one.

(error message will be reported by qemuOpenFileAs, thus will be
Failed to open file '%s')
Thanks for the comments. Fixing it in the next version.

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