[libvirt] [PATCH] Fix loosing the pidfile string of struct _qemuDomainObjPrivate after libvirtd service restarted.

Wangyufei (A) james.wangyufei at huawei.com
Sat Aug 24 09:17:16 UTC 2013


*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 <xuchao1 at huawei.com>
---
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130824/fbe22b9e/attachment-0001.htm>


More information about the libvir-list mailing list