]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: domain: Allow passing in 'parseOpaque' for post-parse of status XML
authorPeter Krempa <pkrempa@redhat.com>
Mon, 28 May 2018 09:36:46 +0000 (11:36 +0200)
committerJán Tomko <jtomko@redhat.com>
Tue, 29 May 2018 08:23:24 +0000 (10:23 +0200)
The status XML parser function virDomainObjParseXML could not pass in
parseOpaque into the post parse callbacks. Add a callback which will
allow hypervisor drivers to fill it from the 'virDomainObj' data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
src/conf/domain_conf.c
src/conf/domain_conf.h

index d021fbc22b5ef8d141263f18a2be14fd59472034..49b2de00d632e7125ef8d1dcf01f689ada6eb69c 100644 (file)
@@ -20547,6 +20547,7 @@ virDomainObjParseXML(xmlDocPtr xml,
     int n;
     int state;
     int reason = 0;
+    void *parseOpaque = NULL;
 
     if (!(obj = virDomainObjNew(xmlopt)))
         return NULL;
@@ -20618,8 +20619,11 @@ virDomainObjParseXML(xmlDocPtr xml,
         xmlopt->privateData.parse(ctxt, obj, &xmlopt->config) < 0)
         goto error;
 
+    if (xmlopt->privateData.getParseOpaque)
+        parseOpaque = xmlopt->privateData.getParseOpaque(obj);
+
     /* callback to fill driver specific domain aspects */
-    if (virDomainDefPostParse(obj->def, caps, flags, xmlopt, NULL) < 0)
+    if (virDomainDefPostParse(obj->def, caps, flags, xmlopt, parseOpaque) < 0)
         goto error;
 
     /* valdiate configuration */
index e10206b35826ffc69f1ed5f2b2d7192732821fca..7c89da371c8246846eacc8d8cd65d2cc14b06470 100644 (file)
@@ -2663,6 +2663,8 @@ typedef int (*virDomainXMLPrivateDataParseFunc)(xmlXPathContextPtr,
                                                 virDomainObjPtr,
                                                 virDomainDefParserConfigPtr);
 
+typedef void *(*virDomainXMLPrivateDataGetParseOpaqueFunc)(virDomainObjPtr vm);
+
 typedef int (*virDomainXMLPrivateDataStorageSourceParseFunc)(xmlXPathContextPtr ctxt,
                                                              virStorageSourcePtr src);
 typedef int (*virDomainXMLPrivateDataStorageSourceFormatFunc)(virStorageSourcePtr src,
@@ -2681,6 +2683,9 @@ struct _virDomainXMLPrivateDataCallbacks {
     virDomainXMLPrivateDataNewFunc    chrSourceNew;
     virDomainXMLPrivateDataFormatFunc format;
     virDomainXMLPrivateDataParseFunc  parse;
+    /* following function shall return a pointer which will be used as the
+     * 'parseOpaque' argument for virDomainDefPostParse */
+    virDomainXMLPrivateDataGetParseOpaqueFunc getParseOpaque;
     virDomainXMLPrivateDataStorageSourceParseFunc storageParse;
     virDomainXMLPrivateDataStorageSourceFormatFunc storageFormat;
 };