Just a stub for now that is unused. Add init+cleanup plumbing and
demostrate it in bridge_driver.c
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/conf/network_conf.c | 33 ++++++++++++++++++++++++++++
src/conf/network_conf.h | 11 ++++++++++
src/libvirt_private.syms | 1 +
src/network/bridge_driver.c | 10 +++++++++
src/network/bridge_driver_platform.h | 2 ++
5 files changed, 57 insertions(+)
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 09e379ae9a..ca4b9986ad 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -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)
{
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index 424c4b0913..edd9f51f44 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -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);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 7dfa5af3b3..5aec33cf52 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -730,6 +730,7 @@ virNetworkSaveConfig;
virNetworkSetBridgeMacAddr;
virNetworkTaintTypeFromString;
virNetworkTaintTypeToString;
+virNetworkXMLOptionNew;
virPortGroupFindByName;
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 6292e3b90a..5be6f1ba45 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -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);
diff --git a/src/network/bridge_driver_platform.h b/src/network/bridge_driver_platform.h
index 95993c5e31..169417a6c0 100644
--- a/src/network/bridge_driver_platform.h
+++ b/src/network/bridge_driver_platform.h
@@ -55,6 +55,8 @@ struct _virNetworkDriverState {
/* Immutable pointer, self-locking APIs */
virObjectEventStatePtr networkEventState;
+
+ virNetworkXMLOptionPtr xmlopt;
};
typedef struct _virNetworkDriverState virNetworkDriverState;
--
2.21.0