conf: domain: Allow passing in 'parseOpaque' for post-parse of status XML

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>
This commit is contained in:
Peter Krempa 2018-05-28 11:36:46 +02:00 committed by Ján Tomko
parent ebd2983e25
commit ac6f736ed1
2 changed files with 10 additions and 1 deletions

View 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 */

View 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;
};