From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau(a)redhat.com>
---
src/conf/domain_conf.c | 21 ++++++++++++++++++++-
src/conf/domain_conf.h | 6 ++++++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3323c9a5b1..9e868b5337 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2451,6 +2451,7 @@ virDomainNetDefFree(virDomainNetDefPtr def)
if (!def)
return;
virDomainNetDefClear(def);
+ virObjectUnref(def->privateData);
VIR_FREE(def);
}
@@ -11434,7 +11435,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
VIR_AUTOFREE(char *) trustGuestRxFilters = NULL;
VIR_AUTOFREE(char *) vhost_path = NULL;
- if (VIR_ALLOC(def) < 0)
+ if (!(def = virDomainNetDefNew(xmlopt)))
return NULL;
ctxt->node = node;
@@ -14312,6 +14313,24 @@ virDomainGraphicsDefNew(virDomainXMLOptionPtr xmlopt)
}
+virDomainNetDefPtr
+virDomainNetDefNew(virDomainXMLOptionPtr xmlopt)
+{
+ virDomainNetDefPtr def = NULL;
+
+ if (VIR_ALLOC(def) < 0)
+ return NULL;
+
+ if (xmlopt && xmlopt->privateData.networkNew &&
+ !(def->privateData = xmlopt->privateData.networkNew())) {
+ VIR_FREE(def);
+ def = NULL;
+ }
+
+ return def;
+}
+
+
/* Parse the XML definition for a graphics device */
static virDomainGraphicsDefPtr
virDomainGraphicsDefParseXML(virDomainXMLOptionPtr xmlopt,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index c1b5fc1337..ebe9ac183e 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1019,6 +1019,7 @@ struct _virDomainNetDef {
unsigned int mtu;
virNetDevCoalescePtr coalesce;
virDomainVirtioOptionsPtr virtio;
+ virObjectPtr privateData;
};
typedef enum {
@@ -2708,6 +2709,7 @@ struct _virDomainXMLPrivateDataCallbacks {
virDomainXMLPrivateDataNewFunc chrSourceNew;
virDomainXMLPrivateDataNewFunc vsockNew;
virDomainXMLPrivateDataNewFunc graphicsNew;
+ virDomainXMLPrivateDataNewFunc networkNew;
virDomainXMLPrivateDataFormatFunc format;
virDomainXMLPrivateDataParseFunc parse;
/* following function shall return a pointer which will be used as the
@@ -2891,6 +2893,10 @@ virDomainChrDefPtr virDomainChrDefNew(virDomainXMLOptionPtr
xmlopt);
virDomainGraphicsDefPtr
virDomainGraphicsDefNew(virDomainXMLOptionPtr xmlopt);
+
+virDomainNetDefPtr
+virDomainNetDefNew(virDomainXMLOptionPtr xmlopt);
+
virDomainDefPtr virDomainDefNew(void);
void virDomainObjAssignDef(virDomainObjPtr domain,
--
2.22.0.214.g8dca754b1e