提交 dc2c4f84 编写于 作者: C Cole Robinson

conf: Add virNetworkXMLOption

Just a stub for now that is unused. Add init+cleanup plumbing and
demostrate it in bridge_driver.c
Reviewed-by: NLaine Stump <laine@laine.org>
Signed-off-by: NCole Robinson <crobinso@redhat.com>
上级 d51522eb
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册