On Mon, Aug 13, 2018 at 05:59:59PM +0200, Peter Krempa wrote:
Allow storing of private data in the status XML for disks.

Signed-off-by: Peter Krempa <pkre...@redhat.com>
---
src/conf/domain_conf.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++
src/conf/domain_conf.h |  7 ++++++
2 files changed, 67 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 93d745bb74..c10e0a9eca 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9676,6 +9676,30 @@ virDomainDiskDefDriverParseXML(virDomainDiskDefPtr def,
}


+static int
+virDomainDiskDefParsePrivateData(xmlXPathContextPtr ctxt,
+                                 virDomainDiskDefPtr disk,
+                                 virDomainXMLOptionPtr xmlopt)
+{
+    xmlNodePtr save_node = ctxt->node;
+    int ret = 0;

Unusual to default to success.

Consider:
xmlNodePtr private_node = virXPathNode("./privateData", ctxt);
if (!private_node)
   return 0;

before overwriting ctxt->node

+
+    if (!xmlopt ||
+        !xmlopt->privateData.diskParse)
+        return 0;
+
+    if (!(ctxt->node = virXPathNode("./privateData", ctxt)))
+        goto cleanup;
+
+    if (xmlopt->privateData.diskParse(ctxt, disk) < 0)
+        ret = -1;
+

Reviewed-by: Ján Tomko <jto...@redhat.com>

Jano

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to