render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
43fe83
From 6b1a948213c7db3eede8350f534ec3813e8b296e Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <6b1a948213c7db3eede8350f534ec3813e8b296e.1379193141.git.jdenemar@redhat.com>
43fe83
From: Laine Stump <laine@laine.org>
43fe83
Date: Thu, 12 Sep 2013 06:32:06 -0600
43fe83
Subject: [PATCH] netcf driver: use a single netcf handle for all connections
43fe83
43fe83
This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=983026
43fe83
43fe83
The netcf interface driver previously had no state driver associated
43fe83
with it - as a connection was opened, it would create a new netcf
43fe83
instance just for that connection, and close it when it was
43fe83
finished. the problem with this is that each connection to libvirt
43fe83
used up a netlink socket, and there is a per process maximum of ~1000
43fe83
netlink sockets.
43fe83
43fe83
The solution is to create a state driver to go along with the netcf
43fe83
driver. The state driver will opens a netcf instance, then all
43fe83
connections share that same netcf instance, thus only a single
43fe83
netlink socket will be used no matter how many connections are mde to
43fe83
libvirtd.
43fe83
43fe83
This was rather simple to do - a new virObjectLockable class is
43fe83
created for the single driverState object, which is created in
43fe83
netcfStateInitialize and contains the single netcf handle; instead of
43fe83
creating a new object for each client connection, netcfInterfaceOpen
43fe83
now just increments the driverState object's reference count and puts
43fe83
a pointer to it into the connection's privateData. Similarly,
43fe83
netcfInterfaceClose() just un-refs the driverState object (as does
43fe83
netcfStateCleanup()), and virNetcfInterfaceDriverStateDispose()
43fe83
handles closing the netcf instance. Since all the functions already
43fe83
have locking around them, the static lock functions used by all
43fe83
functions just needed to be changed to call virObjectLock() and
43fe83
virObjectUnlock() instead of directly calling the virMutex* functions.
43fe83
43fe83
(cherry picked from commit 822fe1367dd55e3de7c3c044ee02fd733ab3415a)
43fe83
---
43fe83
 src/interface/interface_backend_netcf.c | 230 +++++++++++++++++++++-----------
43fe83
 1 file changed, 150 insertions(+), 80 deletions(-)
43fe83
43fe83
diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
43fe83
index f47669e..fac059d 100644
43fe83
--- a/src/interface/interface_backend_netcf.c
43fe83
+++ b/src/interface/interface_backend_netcf.c
43fe83
@@ -41,21 +41,114 @@
43fe83
 /* Main driver state */
43fe83
 typedef struct
43fe83
 {
43fe83
-    virMutex lock;
43fe83
+    virObjectLockable parent;
43fe83
     struct netcf *netcf;
43fe83
 } virNetcfDriverState, *virNetcfDriverStatePtr;
43fe83
 
43fe83
+static virClassPtr virNetcfDriverStateClass;
43fe83
+static void virNetcfDriverStateDispose(void *obj);
43fe83
 
43fe83
-static void interfaceDriverLock(virNetcfDriverStatePtr driver)
43fe83
+static int
43fe83
+virNetcfDriverStateOnceInit(void)
43fe83
+{
43fe83
+    if (!(virNetcfDriverStateClass = virClassNew(virClassForObjectLockable(),
43fe83
+                                       "virNetcfDriverState",
43fe83
+                                       sizeof(virNetcfDriverState),
43fe83
+                                       virNetcfDriverStateDispose)))
43fe83
+        return -1;
43fe83
+    return 0;
43fe83
+}
43fe83
+
43fe83
+VIR_ONCE_GLOBAL_INIT(virNetcfDriverState)
43fe83
+
43fe83
+static virNetcfDriverStatePtr driverState = NULL;
43fe83
+
43fe83
+
43fe83
+static void
43fe83
+virNetcfDriverStateDispose(void *obj)
43fe83
 {
43fe83
-    virMutexLock(&driver->lock);
43fe83
+    virNetcfDriverStatePtr driver = obj;
43fe83
+
43fe83
+    if (driver->netcf)
43fe83
+        ncf_close(driver->netcf);
43fe83
+}
43fe83
+
43fe83
+
43fe83
+static int
43fe83
+netcfStateInitialize(bool privileged ATTRIBUTE_UNUSED,
43fe83
+                     virStateInhibitCallback callback ATTRIBUTE_UNUSED,
43fe83
+                     void *opaque ATTRIBUTE_UNUSED)
43fe83
+{
43fe83
+    if (virNetcfDriverStateInitialize() < 0)
43fe83
+        return -1;
43fe83
+
43fe83
+    if (!(driverState = virObjectLockableNew(virNetcfDriverStateClass)))
43fe83
+        return -1;
43fe83
+
43fe83
+    /* open netcf */
43fe83
+    if (ncf_init(&driverState->netcf, NULL) != 0) {
43fe83
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
43fe83
+                       _("failed to initialize netcf"));
43fe83
+        virObjectUnref(driverState);
43fe83
+        driverState = NULL;
43fe83
+        return -1;
43fe83
+    }
43fe83
+    return 0;
43fe83
 }
43fe83
 
43fe83
-static void interfaceDriverUnlock(virNetcfDriverStatePtr driver)
43fe83
+
43fe83
+static int
43fe83
+netcfStateCleanup(void)
43fe83
 {
43fe83
-    virMutexUnlock(&driver->lock);
43fe83
+    if (!driverState) {
43fe83
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
43fe83
+                       _("Attempt to close netcf state driver already closed"));
43fe83
+        return -1;
43fe83
+    }
43fe83
+
43fe83
+    if (virObjectUnref(driverState)) {
43fe83
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
43fe83
+                       _("Attempt to close netcf state driver "
43fe83
+                         "with open connections"));
43fe83
+        return -1;
43fe83
+    }
43fe83
+    driverState = NULL;
43fe83
+    return 0;
43fe83
 }
43fe83
 
43fe83
+
43fe83
+static int
43fe83
+netcfStateReload(void)
43fe83
+{
43fe83
+    int ret = -1;
43fe83
+
43fe83
+    if (!driverState)
43fe83
+        return 0;
43fe83
+
43fe83
+    virObjectLock(driverState);
43fe83
+    ncf_close(driverState->netcf);
43fe83
+    if (ncf_init(&driverState->netcf, NULL) != 0)
43fe83
+    {
43fe83
+        /* this isn't a good situation, because we can't shut down the
43fe83
+         * driver as there may still be connections to it. If we set
43fe83
+         * the netcf handle to NULL, any subsequent calls to netcf
43fe83
+         * will just fail rather than causing a crash. Not ideal, but
43fe83
+         * livable (since this should never happen).
43fe83
+         */
43fe83
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
43fe83
+                       _("failed to re-init netcf"));
43fe83
+        driverState->netcf = NULL;
43fe83
+        goto cleanup;
43fe83
+    }
43fe83
+
43fe83
+    ret = 0;
43fe83
+cleanup:
43fe83
+    virObjectUnlock(driverState);
43fe83
+
43fe83
+    return ret;
43fe83
+}
43fe83
+
43fe83
+
43fe83
 /*
43fe83
  * Get a minimal virInterfaceDef containing enough metadata
43fe83
  * for access control checks to be performed. Currently
43fe83
@@ -148,61 +241,30 @@ static struct netcf_if *interfaceDriverGetNetcfIF(struct netcf *ncf, virInterfac
43fe83
     return iface;
43fe83
 }
43fe83
 
43fe83
-static virDrvOpenStatus netcfInterfaceOpen(virConnectPtr conn,
43fe83
-                                           virConnectAuthPtr auth ATTRIBUTE_UNUSED,
43fe83
-                                           unsigned int flags)
43fe83
+static virDrvOpenStatus
43fe83
+netcfInterfaceOpen(virConnectPtr conn,
43fe83
+                   virConnectAuthPtr auth ATTRIBUTE_UNUSED,
43fe83
+                   unsigned int flags)
43fe83
 {
43fe83
-    virNetcfDriverStatePtr driverState;
43fe83
-
43fe83
     virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
43fe83
 
43fe83
-    if (VIR_ALLOC(driverState) < 0)
43fe83
-        goto alloc_error;
43fe83
-
43fe83
-    /* initialize non-0 stuff in driverState */
43fe83
-    if (virMutexInit(&driverState->lock) < 0)
43fe83
-    {
43fe83
-        /* what error to report? */
43fe83
-        goto mutex_error;
43fe83
-    }
43fe83
-
43fe83
-    /* open netcf */
43fe83
-    if (ncf_init(&driverState->netcf, NULL) != 0)
43fe83
-    {
43fe83
-        /* what error to report? */
43fe83
-        goto netcf_error;
43fe83
-    }
43fe83
+    if (!driverState)
43fe83
+        return VIR_DRV_OPEN_ERROR;
43fe83
 
43fe83
+    virObjectRef(driverState);
43fe83
     conn->interfacePrivateData = driverState;
43fe83
     return VIR_DRV_OPEN_SUCCESS;
43fe83
-
43fe83
-netcf_error:
43fe83
-    if (driverState->netcf)
43fe83
-    {
43fe83
-        ncf_close(driverState->netcf);
43fe83
-    }
43fe83
-    virMutexDestroy(&driverState->lock);
43fe83
-mutex_error:
43fe83
-    VIR_FREE(driverState);
43fe83
-alloc_error:
43fe83
-    return VIR_DRV_OPEN_ERROR;
43fe83
 }
43fe83
 
43fe83
-static int netcfInterfaceClose(virConnectPtr conn)
43fe83
+static int
43fe83
+netcfInterfaceClose(virConnectPtr conn)
43fe83
 {
43fe83
 
43fe83
     if (conn->interfacePrivateData != NULL)
43fe83
     {
43fe83
-        virNetcfDriverStatePtr driver = conn->interfacePrivateData;
43fe83
-
43fe83
-        /* close netcf instance */
43fe83
-        ncf_close(driver->netcf);
43fe83
-        /* destroy lock */
43fe83
-        virMutexDestroy(&driver->lock);
43fe83
-        /* free driver state */
43fe83
-        VIR_FREE(driver);
43fe83
+        virObjectUnref(conn->interfacePrivateData);
43fe83
+        conn->interfacePrivateData = NULL;
43fe83
     }
43fe83
-    conn->interfacePrivateData = NULL;
43fe83
     return 0;
43fe83
 }
43fe83
 
43fe83
@@ -408,11 +470,11 @@ static int netcfConnectNumOfInterfaces(virConnectPtr conn)
43fe83
     if (virConnectNumOfInterfacesEnsureACL(conn) < 0)
43fe83
         return -1;
43fe83
 
43fe83
-    interfaceDriverLock(driver);
43fe83
+    virObjectLock(driver);
43fe83
     count = netcfConnectNumOfInterfacesImpl(conn,
43fe83
                                             NETCF_IFACE_ACTIVE,
43fe83
                                             virConnectNumOfInterfacesCheckACL);
43fe83
-    interfaceDriverUnlock(driver);
43fe83
+    virObjectUnlock(driver);
43fe83
     return count;
43fe83
 }
43fe83
 
43fe83
@@ -424,12 +486,12 @@ static int netcfConnectListInterfaces(virConnectPtr conn, char **const names, in
43fe83
     if (virConnectListInterfacesEnsureACL(conn) < 0)
43fe83
         return -1;
43fe83
 
43fe83
-    interfaceDriverLock(driver);
43fe83
+    virObjectLock(driver);
43fe83
     count = netcfConnectListInterfacesImpl(conn,
43fe83
                                            NETCF_IFACE_ACTIVE,
43fe83
                                            names, nnames,
43fe83
                                            virConnectListInterfacesCheckACL);
43fe83
-    interfaceDriverUnlock(driver);
43fe83
+    virObjectUnlock(driver);
43fe83
     return count;
43fe83
 
43fe83
 }
43fe83
@@ -442,11 +504,11 @@ static int netcfConnectNumOfDefinedInterfaces(virConnectPtr conn)
43fe83
     if (virConnectNumOfDefinedInterfacesEnsureACL(conn) < 0)
43fe83
         return -1;
43fe83
 
43fe83
-    interfaceDriverLock(driver);
43fe83
+    virObjectLock(driver);
43fe83
     count = netcfConnectNumOfInterfacesImpl(conn,
43fe83
                                             NETCF_IFACE_INACTIVE,
43fe83
                                             virConnectNumOfDefinedInterfacesCheckACL);
43fe83
-    interfaceDriverUnlock(driver);
43fe83
+    virObjectUnlock(driver);
43fe83
     return count;
43fe83
 }
43fe83
 
43fe83
@@ -458,12 +520,12 @@ static int netcfConnectListDefinedInterfaces(virConnectPtr conn, char **const na
43fe83
     if (virConnectListDefinedInterfacesEnsureACL(conn) < 0)
43fe83
         return -1;
43fe83
 
43fe83
-    interfaceDriverLock(driver);
43fe83
+    virObjectLock(driver);
43fe83
     count = netcfConnectListInterfacesImpl(conn,
43fe83
                                            NETCF_IFACE_INACTIVE,
43fe83
                                            names, nnames,
43fe83
                                            virConnectListDefinedInterfacesCheckACL);
43fe83
-    interfaceDriverUnlock(driver);
43fe83
+    virObjectUnlock(driver);
43fe83
     return count;
43fe83
 
43fe83
 }
43fe83
@@ -490,7 +552,7 @@ netcfConnectListAllInterfaces(virConnectPtr conn,
43fe83
     if (virConnectListAllInterfacesEnsureACL(conn) < 0)
43fe83
         return -1;
43fe83
 
43fe83
-    interfaceDriverLock(driver);
43fe83
+    virObjectLock(driver);
43fe83
 
43fe83
     /* List all interfaces, in case of we might support new filter flags
43fe83
      * except active|inactive in future.
43fe83
@@ -621,7 +683,7 @@ cleanup:
43fe83
         VIR_FREE(tmp_iface_objs);
43fe83
     }
43fe83
 
43fe83
-    interfaceDriverUnlock(driver);
43fe83
+    virObjectUnlock(driver);
43fe83
     return ret;
43fe83
 }
43fe83
 
43fe83
@@ -634,7 +696,7 @@ static virInterfacePtr netcfInterfaceLookupByName(virConnectPtr conn,
43fe83
     virInterfacePtr ret = NULL;
43fe83
     virInterfaceDefPtr def = NULL;
43fe83
 
43fe83
-    interfaceDriverLock(driver);
43fe83
+    virObjectLock(driver);
43fe83
     iface = ncf_lookup_by_name(driver->netcf, name);
43fe83
     if (!iface) {
43fe83
         const char *errmsg, *details;
43fe83
@@ -662,7 +724,7 @@ static virInterfacePtr netcfInterfaceLookupByName(virConnectPtr conn,
43fe83
 cleanup:
43fe83
     ncf_if_free(iface);
43fe83
     virInterfaceDefFree(def);
43fe83
-    interfaceDriverUnlock(driver);
43fe83
+    virObjectUnlock(driver);
43fe83
     return ret;
43fe83
 }
43fe83
 
43fe83
@@ -675,7 +737,7 @@ static virInterfacePtr netcfInterfaceLookupByMACString(virConnectPtr conn,
43fe83
     virInterfacePtr ret = NULL;
43fe83
     virInterfaceDefPtr def = NULL;
43fe83
 
43fe83
-    interfaceDriverLock(driver);
43fe83
+    virObjectLock(driver);
43fe83
     niface = ncf_lookup_by_mac_string(driver->netcf, macstr, 1, &iface);
43fe83
 
43fe83
     if (niface < 0) {
43fe83
@@ -711,7 +773,7 @@ static virInterfacePtr netcfInterfaceLookupByMACString(virConnectPtr conn,
43fe83
 cleanup:
43fe83
     ncf_if_free(iface);
43fe83
     virInterfaceDefFree(def);
43fe83
-    interfaceDriverUnlock(driver);
43fe83
+    virObjectUnlock(driver);
43fe83
     return ret;
43fe83
 }
43fe83
 
43fe83
@@ -726,7 +788,7 @@ static char *netcfInterfaceGetXMLDesc(virInterfacePtr ifinfo,
43fe83
 
43fe83
     virCheckFlags(VIR_INTERFACE_XML_INACTIVE, NULL);
43fe83
 
43fe83
-    interfaceDriverLock(driver);
43fe83
+    virObjectLock(driver);
43fe83
 
43fe83
     iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
43fe83
     if (!iface) {
43fe83
@@ -768,7 +830,7 @@ cleanup:
43fe83
     ncf_if_free(iface);
43fe83
     VIR_FREE(xmlstr);
43fe83
     virInterfaceDefFree(ifacedef);
43fe83
-    interfaceDriverUnlock(driver);
43fe83
+    virObjectUnlock(driver);
43fe83
     return ret;
43fe83
 }
43fe83
 
43fe83
@@ -784,7 +846,7 @@ static virInterfacePtr netcfInterfaceDefineXML(virConnectPtr conn,
43fe83
 
43fe83
     virCheckFlags(0, NULL);
43fe83
 
43fe83
-    interfaceDriverLock(driver);
43fe83
+    virObjectLock(driver);
43fe83
 
43fe83
     ifacedef = virInterfaceDefParseString(xml);
43fe83
     if (!ifacedef) {
43fe83
@@ -818,7 +880,7 @@ cleanup:
43fe83
     ncf_if_free(iface);
43fe83
     VIR_FREE(xmlstr);
43fe83
     virInterfaceDefFree(ifacedef);
43fe83
-    interfaceDriverUnlock(driver);
43fe83
+    virObjectUnlock(driver);
43fe83
     return ret;
43fe83
 }
43fe83
 
43fe83
@@ -828,7 +890,7 @@ static int netcfInterfaceUndefine(virInterfacePtr ifinfo) {
43fe83
     virInterfaceDefPtr def = NULL;
43fe83
     int ret = -1;
43fe83
 
43fe83
-    interfaceDriverLock(driver);
43fe83
+    virObjectLock(driver);
43fe83
 
43fe83
     iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
43fe83
     if (!iface) {
43fe83
@@ -857,7 +919,7 @@ static int netcfInterfaceUndefine(virInterfacePtr ifinfo) {
43fe83
 cleanup:
43fe83
     ncf_if_free(iface);
43fe83
     virInterfaceDefFree(def);
43fe83
-    interfaceDriverUnlock(driver);
43fe83
+    virObjectUnlock(driver);
43fe83
     return ret;
43fe83
 }
43fe83
 
43fe83
@@ -871,7 +933,7 @@ static int netcfInterfaceCreate(virInterfacePtr ifinfo,
43fe83
 
43fe83
     virCheckFlags(0, -1);
43fe83
 
43fe83
-    interfaceDriverLock(driver);
43fe83
+    virObjectLock(driver);
43fe83
 
43fe83
     iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
43fe83
     if (!iface) {
43fe83
@@ -900,7 +962,7 @@ static int netcfInterfaceCreate(virInterfacePtr ifinfo,
43fe83
 cleanup:
43fe83
     ncf_if_free(iface);
43fe83
     virInterfaceDefFree(def);
43fe83
-    interfaceDriverUnlock(driver);
43fe83
+    virObjectUnlock(driver);
43fe83
     return ret;
43fe83
 }
43fe83
 
43fe83
@@ -914,7 +976,7 @@ static int netcfInterfaceDestroy(virInterfacePtr ifinfo,
43fe83
 
43fe83
     virCheckFlags(0, -1);
43fe83
 
43fe83
-    interfaceDriverLock(driver);
43fe83
+    virObjectLock(driver);
43fe83
 
43fe83
     iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
43fe83
     if (!iface) {
43fe83
@@ -943,7 +1005,7 @@ static int netcfInterfaceDestroy(virInterfacePtr ifinfo,
43fe83
 cleanup:
43fe83
     ncf_if_free(iface);
43fe83
     virInterfaceDefFree(def);
43fe83
-    interfaceDriverUnlock(driver);
43fe83
+    virObjectUnlock(driver);
43fe83
     return ret;
43fe83
 }
43fe83
 
43fe83
@@ -955,7 +1017,7 @@ static int netcfInterfaceIsActive(virInterfacePtr ifinfo)
43fe83
     virInterfaceDefPtr def = NULL;
43fe83
     int ret = -1;
43fe83
 
43fe83
-    interfaceDriverLock(driver);
43fe83
+    virObjectLock(driver);
43fe83
 
43fe83
     iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
43fe83
     if (!iface) {
43fe83
@@ -985,7 +1047,7 @@ static int netcfInterfaceIsActive(virInterfacePtr ifinfo)
43fe83
 cleanup:
43fe83
     ncf_if_free(iface);
43fe83
     virInterfaceDefFree(def);
43fe83
-    interfaceDriverUnlock(driver);
43fe83
+    virObjectUnlock(driver);
43fe83
     return ret;
43fe83
 }
43fe83
 
43fe83
@@ -1000,7 +1062,7 @@ static int netcfInterfaceChangeBegin(virConnectPtr conn, unsigned int flags)
43fe83
     if (virInterfaceChangeBeginEnsureACL(conn) < 0)
43fe83
         return -1;
43fe83
 
43fe83
-    interfaceDriverLock(driver);
43fe83
+    virObjectLock(driver);
43fe83
 
43fe83
     ret = ncf_change_begin(driver->netcf, 0);
43fe83
     if (ret < 0) {
43fe83
@@ -1012,7 +1074,7 @@ static int netcfInterfaceChangeBegin(virConnectPtr conn, unsigned int flags)
43fe83
                        details ? details : "");
43fe83
     }
43fe83
 
43fe83
-    interfaceDriverUnlock(driver);
43fe83
+    virObjectUnlock(driver);
43fe83
     return ret;
43fe83
 }
43fe83
 
43fe83
@@ -1026,7 +1088,7 @@ static int netcfInterfaceChangeCommit(virConnectPtr conn, unsigned int flags)
43fe83
     if (virInterfaceChangeCommitEnsureACL(conn) < 0)
43fe83
         return -1;
43fe83
 
43fe83
-    interfaceDriverLock(driver);
43fe83
+    virObjectLock(driver);
43fe83
 
43fe83
     ret = ncf_change_commit(driver->netcf, 0);
43fe83
     if (ret < 0) {
43fe83
@@ -1038,7 +1100,7 @@ static int netcfInterfaceChangeCommit(virConnectPtr conn, unsigned int flags)
43fe83
                        details ? details : "");
43fe83
     }
43fe83
 
43fe83
-    interfaceDriverUnlock(driver);
43fe83
+    virObjectUnlock(driver);
43fe83
     return ret;
43fe83
 }
43fe83
 
43fe83
@@ -1052,7 +1114,7 @@ static int netcfInterfaceChangeRollback(virConnectPtr conn, unsigned int flags)
43fe83
     if (virInterfaceChangeRollbackEnsureACL(conn) < 0)
43fe83
         return -1;
43fe83
 
43fe83
-    interfaceDriverLock(driver);
43fe83
+    virObjectLock(driver);
43fe83
 
43fe83
     ret = ncf_change_rollback(driver->netcf, 0);
43fe83
     if (ret < 0) {
43fe83
@@ -1064,13 +1126,13 @@ static int netcfInterfaceChangeRollback(virConnectPtr conn, unsigned int flags)
43fe83
                        details ? details : "");
43fe83
     }
43fe83
 
43fe83
-    interfaceDriverUnlock(driver);
43fe83
+    virObjectUnlock(driver);
43fe83
     return ret;
43fe83
 }
43fe83
 #endif /* HAVE_NETCF_TRANSACTIONS */
43fe83
 
43fe83
 static virInterfaceDriver interfaceDriver = {
43fe83
-    "netcf",
43fe83
+    .name = INTERFACE_DRIVER_NAME,
43fe83
     .interfaceOpen = netcfInterfaceOpen, /* 0.7.0 */
43fe83
     .interfaceClose = netcfInterfaceClose, /* 0.7.0 */
43fe83
     .connectNumOfInterfaces = netcfConnectNumOfInterfaces, /* 0.7.0 */
43fe83
@@ -1093,11 +1155,19 @@ static virInterfaceDriver interfaceDriver = {
43fe83
 #endif /* HAVE_NETCF_TRANSACTIONS */
43fe83
 };
43fe83
 
43fe83
+static virStateDriver interfaceStateDriver = {
43fe83
+    .name = INTERFACE_DRIVER_NAME,
43fe83
+    .stateInitialize = netcfStateInitialize,
43fe83
+    .stateCleanup = netcfStateCleanup,
43fe83
+    .stateReload = netcfStateReload,
43fe83
+};
43fe83
+
43fe83
 int netcfIfaceRegister(void) {
43fe83
     if (virRegisterInterfaceDriver(&interfaceDriver) < 0) {
43fe83
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
43fe83
                        _("failed to register netcf interface driver"));
43fe83
         return -1;
43fe83
     }
43fe83
+    virRegisterStateDriver(&interfaceStateDriver);
43fe83
     return 0;
43fe83
 }
43fe83
-- 
43fe83
1.8.3.2
43fe83