mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
conf: Add virNetworkXMLOption
Just a stub for now that is unused. Add init+cleanup plumbing and demostrate it in bridge_driver.c Reviewed-by: Laine Stump <laine@laine.org> Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
d51522eb57
commit
dc2c4f8435
@ -73,6 +73,39 @@ VIR_ENUM_IMPL(virNetworkTaint,
|
||||
"hook-script",
|
||||
);
|
||||
|
||||
static virClassPtr virNetworkXMLOptionClass;
|
||||
|
||||
static void
|
||||
virNetworkXMLOptionDispose(void *obj ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static int
|
||||
virNetworkXMLOnceInit(void)
|
||||
{
|
||||
if (!VIR_CLASS_NEW(virNetworkXMLOption, virClassForObject()))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIR_ONCE_GLOBAL_INIT(virNetworkXML);
|
||||
|
||||
virNetworkXMLOptionPtr
|
||||
virNetworkXMLOptionNew(void)
|
||||
{
|
||||
virNetworkXMLOptionPtr xmlopt;
|
||||
|
||||
if (virNetworkXMLInitialize() < 0)
|
||||
return NULL;
|
||||
|
||||
if (!(xmlopt = virObjectNew(virNetworkXMLOptionClass)))
|
||||
return NULL;
|
||||
|
||||
return xmlopt;
|
||||
}
|
||||
|
||||
static void
|
||||
virPortGroupDefClear(virPortGroupDefPtr def)
|
||||
{
|
||||
|
@ -41,6 +41,14 @@
|
||||
#include "virmacmap.h"
|
||||
#include "virenum.h"
|
||||
|
||||
|
||||
struct _virNetworkXMLOption {
|
||||
virObject parent;
|
||||
};
|
||||
typedef struct _virNetworkXMLOption virNetworkXMLOption;
|
||||
typedef virNetworkXMLOption *virNetworkXMLOptionPtr;
|
||||
|
||||
|
||||
typedef enum {
|
||||
VIR_NETWORK_FORWARD_NONE = 0,
|
||||
VIR_NETWORK_FORWARD_NAT,
|
||||
@ -289,6 +297,9 @@ enum {
|
||||
VIR_NETWORK_OBJ_LIST_ADD_CHECK_LIVE = (1 << 1),
|
||||
};
|
||||
|
||||
virNetworkXMLOptionPtr
|
||||
virNetworkXMLOptionNew(void);
|
||||
|
||||
virNetworkDefPtr
|
||||
virNetworkDefCopy(virNetworkDefPtr def, unsigned int flags);
|
||||
|
||||
|
@ -730,6 +730,7 @@ virNetworkSaveConfig;
|
||||
virNetworkSetBridgeMacAddr;
|
||||
virNetworkTaintTypeFromString;
|
||||
virNetworkTaintTypeToString;
|
||||
virNetworkXMLOptionNew;
|
||||
virPortGroupFindByName;
|
||||
|
||||
|
||||
|
@ -136,6 +136,12 @@ networkDnsmasqCapsRefresh(virNetworkDriverStatePtr driver)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static virNetworkXMLOptionPtr
|
||||
networkDnsmasqCreateXMLConf(void)
|
||||
{
|
||||
return virNetworkXMLOptionNew();
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
networkStateCleanup(void);
|
||||
@ -605,6 +611,9 @@ networkStateInitialize(bool privileged,
|
||||
|
||||
network_driver->privileged = privileged;
|
||||
|
||||
if (!(network_driver->xmlopt = networkDnsmasqCreateXMLConf()))
|
||||
goto error;
|
||||
|
||||
/* configuration/state paths are one of
|
||||
* ~/.config/libvirt/... (session/unprivileged)
|
||||
* /etc/libvirt/... && /var/(run|lib)/libvirt/... (system/privileged).
|
||||
@ -766,6 +775,7 @@ networkStateCleanup(void)
|
||||
return -1;
|
||||
|
||||
virObjectUnref(network_driver->networkEventState);
|
||||
virObjectUnref(network_driver->xmlopt);
|
||||
|
||||
/* free inactive networks */
|
||||
virObjectUnref(network_driver->networks);
|
||||
|
@ -55,6 +55,8 @@ struct _virNetworkDriverState {
|
||||
|
||||
/* Immutable pointer, self-locking APIs */
|
||||
virObjectEventStatePtr networkEventState;
|
||||
|
||||
virNetworkXMLOptionPtr xmlopt;
|
||||
};
|
||||
|
||||
typedef struct _virNetworkDriverState virNetworkDriverState;
|
||||
|
Loading…
Reference in New Issue
Block a user