Re: [PATCHv2 25/62] conf: Implement private data formatting and parsing for disks

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

 



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 <pkrempa@xxxxxxxxxx>
---
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 <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: Digital signature

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