mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
domain-conf: add network def private data
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
2b0251af68
commit
1b336f4a0e
@ -501,7 +501,7 @@ bhyveParsePCINet(virDomainDefPtr def,
|
||||
const char *separator = NULL;
|
||||
const char *mac = NULL;
|
||||
|
||||
if (VIR_ALLOC(net) < 0)
|
||||
if (!(net = virDomainNetDefNew(xmlopt)))
|
||||
goto cleanup;
|
||||
|
||||
/* As we only support interface type='bridge' and cannot
|
||||
|
@ -2455,6 +2455,7 @@ virDomainNetDefFree(virDomainNetDefPtr def)
|
||||
if (!def)
|
||||
return;
|
||||
virDomainNetDefClear(def);
|
||||
virObjectUnref(def->privateData);
|
||||
VIR_FREE(def);
|
||||
}
|
||||
|
||||
@ -11449,7 +11450,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;
|
||||
@ -14345,6 +14346,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())) {
|
||||
virDomainNetDefFree(def);
|
||||
def = NULL;
|
||||
}
|
||||
|
||||
return def;
|
||||
}
|
||||
|
||||
|
||||
/* Parse the XML definition for a graphics device */
|
||||
static virDomainGraphicsDefPtr
|
||||
virDomainGraphicsDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
|
@ -1018,6 +1018,7 @@ struct _virDomainNetDef {
|
||||
unsigned int mtu;
|
||||
virNetDevCoalescePtr coalesce;
|
||||
virDomainVirtioOptionsPtr virtio;
|
||||
virObjectPtr privateData;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
@ -2713,6 +2714,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
|
||||
@ -2897,6 +2899,10 @@ virDomainChrDefPtr virDomainChrDefNew(virDomainXMLOptionPtr xmlopt);
|
||||
|
||||
virDomainGraphicsDefPtr
|
||||
virDomainGraphicsDefNew(virDomainXMLOptionPtr xmlopt);
|
||||
|
||||
virDomainNetDefPtr
|
||||
virDomainNetDefNew(virDomainXMLOptionPtr xmlopt);
|
||||
|
||||
virDomainDefPtr virDomainDefNew(void);
|
||||
|
||||
void virDomainObjAssignDef(virDomainObjPtr domain,
|
||||
|
@ -478,6 +478,7 @@ virDomainNetDefActualToNetworkPort;
|
||||
virDomainNetDefClear;
|
||||
virDomainNetDefFormat;
|
||||
virDomainNetDefFree;
|
||||
virDomainNetDefNew;
|
||||
virDomainNetDefToNetworkPort;
|
||||
virDomainNetFind;
|
||||
virDomainNetFindByName;
|
||||
|
@ -1234,7 +1234,7 @@ xenParseVif(char *entry, const char *vif_typename)
|
||||
key = nextkey;
|
||||
}
|
||||
|
||||
if (VIR_ALLOC(net) < 0)
|
||||
if (!(net = virDomainNetDefNew(NULL)))
|
||||
goto cleanup;
|
||||
|
||||
if (mac[0]) {
|
||||
|
@ -359,7 +359,7 @@ lxcCreateNetDef(const char *type,
|
||||
virDomainNetDefPtr net = NULL;
|
||||
virMacAddr macAddr;
|
||||
|
||||
if (VIR_ALLOC(net) < 0)
|
||||
if (!(net = virDomainNetDefNew(NULL)))
|
||||
goto error;
|
||||
|
||||
if (STREQ_NULLABLE(flag, "up"))
|
||||
|
@ -3692,7 +3692,7 @@ vboxDumpNetwork(vboxDriverPtr data, INetworkAdapter *adapter)
|
||||
char *utf8 = NULL;
|
||||
virDomainNetDefPtr net = NULL;
|
||||
|
||||
if (VIR_ALLOC(net) < 0)
|
||||
if (!(net = virDomainNetDefNew(data->xmlopt)))
|
||||
return NULL;
|
||||
|
||||
gVBoxAPI.UINetworkAdapter.GetAttachmentType(adapter, &attachmentType);
|
||||
|
Loading…
x
Reference in New Issue
Block a user