mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +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 *separator = NULL;
|
||||||
const char *mac = NULL;
|
const char *mac = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(net) < 0)
|
if (!(net = virDomainNetDefNew(xmlopt)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* As we only support interface type='bridge' and cannot
|
/* As we only support interface type='bridge' and cannot
|
||||||
|
@ -2455,6 +2455,7 @@ virDomainNetDefFree(virDomainNetDefPtr def)
|
|||||||
if (!def)
|
if (!def)
|
||||||
return;
|
return;
|
||||||
virDomainNetDefClear(def);
|
virDomainNetDefClear(def);
|
||||||
|
virObjectUnref(def->privateData);
|
||||||
VIR_FREE(def);
|
VIR_FREE(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11449,7 +11450,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||||||
VIR_AUTOFREE(char *) trustGuestRxFilters = NULL;
|
VIR_AUTOFREE(char *) trustGuestRxFilters = NULL;
|
||||||
VIR_AUTOFREE(char *) vhost_path = NULL;
|
VIR_AUTOFREE(char *) vhost_path = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(def) < 0)
|
if (!(def = virDomainNetDefNew(xmlopt)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ctxt->node = node;
|
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 */
|
/* Parse the XML definition for a graphics device */
|
||||||
static virDomainGraphicsDefPtr
|
static virDomainGraphicsDefPtr
|
||||||
virDomainGraphicsDefParseXML(virDomainXMLOptionPtr xmlopt,
|
virDomainGraphicsDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||||
|
@ -1018,6 +1018,7 @@ struct _virDomainNetDef {
|
|||||||
unsigned int mtu;
|
unsigned int mtu;
|
||||||
virNetDevCoalescePtr coalesce;
|
virNetDevCoalescePtr coalesce;
|
||||||
virDomainVirtioOptionsPtr virtio;
|
virDomainVirtioOptionsPtr virtio;
|
||||||
|
virObjectPtr privateData;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -2713,6 +2714,7 @@ struct _virDomainXMLPrivateDataCallbacks {
|
|||||||
virDomainXMLPrivateDataNewFunc chrSourceNew;
|
virDomainXMLPrivateDataNewFunc chrSourceNew;
|
||||||
virDomainXMLPrivateDataNewFunc vsockNew;
|
virDomainXMLPrivateDataNewFunc vsockNew;
|
||||||
virDomainXMLPrivateDataNewFunc graphicsNew;
|
virDomainXMLPrivateDataNewFunc graphicsNew;
|
||||||
|
virDomainXMLPrivateDataNewFunc networkNew;
|
||||||
virDomainXMLPrivateDataFormatFunc format;
|
virDomainXMLPrivateDataFormatFunc format;
|
||||||
virDomainXMLPrivateDataParseFunc parse;
|
virDomainXMLPrivateDataParseFunc parse;
|
||||||
/* following function shall return a pointer which will be used as the
|
/* following function shall return a pointer which will be used as the
|
||||||
@ -2897,6 +2899,10 @@ virDomainChrDefPtr virDomainChrDefNew(virDomainXMLOptionPtr xmlopt);
|
|||||||
|
|
||||||
virDomainGraphicsDefPtr
|
virDomainGraphicsDefPtr
|
||||||
virDomainGraphicsDefNew(virDomainXMLOptionPtr xmlopt);
|
virDomainGraphicsDefNew(virDomainXMLOptionPtr xmlopt);
|
||||||
|
|
||||||
|
virDomainNetDefPtr
|
||||||
|
virDomainNetDefNew(virDomainXMLOptionPtr xmlopt);
|
||||||
|
|
||||||
virDomainDefPtr virDomainDefNew(void);
|
virDomainDefPtr virDomainDefNew(void);
|
||||||
|
|
||||||
void virDomainObjAssignDef(virDomainObjPtr domain,
|
void virDomainObjAssignDef(virDomainObjPtr domain,
|
||||||
|
@ -478,6 +478,7 @@ virDomainNetDefActualToNetworkPort;
|
|||||||
virDomainNetDefClear;
|
virDomainNetDefClear;
|
||||||
virDomainNetDefFormat;
|
virDomainNetDefFormat;
|
||||||
virDomainNetDefFree;
|
virDomainNetDefFree;
|
||||||
|
virDomainNetDefNew;
|
||||||
virDomainNetDefToNetworkPort;
|
virDomainNetDefToNetworkPort;
|
||||||
virDomainNetFind;
|
virDomainNetFind;
|
||||||
virDomainNetFindByName;
|
virDomainNetFindByName;
|
||||||
|
@ -1234,7 +1234,7 @@ xenParseVif(char *entry, const char *vif_typename)
|
|||||||
key = nextkey;
|
key = nextkey;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC(net) < 0)
|
if (!(net = virDomainNetDefNew(NULL)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (mac[0]) {
|
if (mac[0]) {
|
||||||
|
@ -359,7 +359,7 @@ lxcCreateNetDef(const char *type,
|
|||||||
virDomainNetDefPtr net = NULL;
|
virDomainNetDefPtr net = NULL;
|
||||||
virMacAddr macAddr;
|
virMacAddr macAddr;
|
||||||
|
|
||||||
if (VIR_ALLOC(net) < 0)
|
if (!(net = virDomainNetDefNew(NULL)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (STREQ_NULLABLE(flag, "up"))
|
if (STREQ_NULLABLE(flag, "up"))
|
||||||
|
@ -3692,7 +3692,7 @@ vboxDumpNetwork(vboxDriverPtr data, INetworkAdapter *adapter)
|
|||||||
char *utf8 = NULL;
|
char *utf8 = NULL;
|
||||||
virDomainNetDefPtr net = NULL;
|
virDomainNetDefPtr net = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(net) < 0)
|
if (!(net = virDomainNetDefNew(data->xmlopt)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
gVBoxAPI.UINetworkAdapter.GetAttachmentType(adapter, &attachmentType);
|
gVBoxAPI.UINetworkAdapter.GetAttachmentType(adapter, &attachmentType);
|
||||||
|
Loading…
Reference in New Issue
Block a user