*src/qemu/qemu_domain.c (qemuDomainObjPrivateXMLFormat): Add codes of saving 
pidfile string to vm'state file.
*src/qemu/qemu_domain.c (qemuDomainObjPrivateXMLParse): Add codes of loading 
pidfile path saved in vm's state file to the pidfile string.

Signed-off-by: Xu Chao <[email protected]>
---
src/qemu/qemu_domain.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 7f4d17d..3c792ab 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -294,6 +294,7 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
                           virDomainChrTypeToString(priv->monConfig->type));
     }
+    virBufferEscapeString(buf, "  <pidfile path='%s'/>\n", priv->pidfile);
     if (priv->nvcpupids) {
         size_t i;
@@ -398,6 +399,13 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void 
*data)
         goto error;
     }
+    if (!(priv->pidfile =
+          virXPathString("string(./pid[1]/@path)", ctxt))) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("no pidfile path"));
+        goto error;
+    }
+
     n = virXPathNodeSet("./vcpus/vcpu", ctxt, &nodes);
     if (n < 0)
         goto error;

Best Regards,
-WangYufei

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to