[libvirt] [RFC][PATCH 6/7] interface: Implement the driver methods

Michal Privoznik mprivozn at redhat.com
Mon May 9 19:28:52 UTC 2011


---
 configure.ac                 |    5 +++++
 src/interface/netcf_driver.c |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index dcec371..041d738 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1483,6 +1483,11 @@ if test "$with_netcf" = "yes" || test "$with_netcf" = "check"; then
   if test "$with_netcf" = "yes" ; then
     AC_DEFINE_UNQUOTED([WITH_NETCF], 1,
       [whether libnetcf is available to configure physical host network interfaces])
+    AC_CHECK_LIB([netcf], [ncf_change_start], [new_netcf=1], [new_netcf=0])
+    if test "$new_netcf" = "1" ; then
+        AC_DEFINE_UNQUOTED([HAVE_NCF_CHANGE_START], ["1"],
+          [we have sufficiently new version of netcf for transaction network API])
+    fi
   fi
 fi
 AM_CONDITIONAL([WITH_NETCF], [test "$with_netcf" = "yes"])
diff --git a/src/interface/netcf_driver.c b/src/interface/netcf_driver.c
index fc7979c..082c4eb 100644
--- a/src/interface/netcf_driver.c
+++ b/src/interface/netcf_driver.c
@@ -30,6 +30,7 @@
 #include "netcf_driver.h"
 #include "interface_conf.h"
 #include "memory.h"
+#include "logging.h"
 
 #define VIR_FROM_THIS VIR_FROM_INTERFACE
 
@@ -540,6 +541,35 @@ cleanup:
     return ret;
 }
 
+#ifdef HAVE_NCF_CHANGE_START
+static int interfaceChangeStart(virConnectPtr conn ATTRIBUTE_UNUSED,
+                                unsigned int flags ATTRIBUTE_UNUSED)
+{
+    VIR_DEBUG0("A long time ago in a galaxy far, far away....");
+    /* Nothing here yet */
+
+    return 0;
+}
+
+static int interfaceChangeCommit(virConnectPtr conn ATTRIBUTE_UNUSED,
+                                 unsigned int flags ATTRIBUTE_UNUSED)
+{
+    VIR_DEBUG0("I am fish");
+    /* Nothing here yet */
+
+    return 0;
+}
+
+static int interfaceChangeRollback(virConnectPtr conn ATTRIBUTE_UNUSED,
+                                   unsigned int flags ATTRIBUTE_UNUSED)
+{
+    VIR_DEBUG0("Hello, IT. Have you tried turning it off and on again?");
+    /* Nothing here yet */
+
+    return 0;
+}
+#endif /* HAVE_NCF_CHANGE_START */
+
 static virInterfaceDriver interfaceDriver = {
     "Interface",
     interfaceOpenInterface,          /* open */
@@ -556,9 +586,15 @@ static virInterfaceDriver interfaceDriver = {
     interfaceCreate,                 /* interfaceCreate */
     interfaceDestroy,                /* interfaceDestroy */
     interfaceIsActive,               /* interfaceIsActive */
+#ifdef HAVE_NCF_CHANGE_START
+    interfaceChangeStart,            /* interfaceChangeStart */
+    interfaceChangeCommit,           /* interfaceChangeCommit */
+    interfaceChangeRollback,         /* interfaceChangeRollback */
+#else
     NULL,                            /* interfaceChangeStart */
     NULL,                            /* interfaceChangeCommit */
     NULL,                            /* interfaceChangeRollback */
+#endif /* HAVE_NCF_CHANGE_START */
 };
 
 int interfaceRegister(void) {
-- 
1.7.5.rc3




More information about the libvir-list mailing list