Index: libvirt-0.9.10/configure.ac =================================================================== --- libvirt-0.9.10.orig/configure.ac +++ libvirt-0.9.10/configure.ac @@ -63,6 +63,7 @@ AVAHI_REQUIRED="0.6.0" POLKIT_REQUIRED="0.6" PARTED_REQUIRED="1.8.0" NETCF_REQUIRED="0.1.4" +NETCONTROL_REQUIRED="0.2.0" UDEV_REQUIRED=145 PCIACCESS_REQUIRED=0.10.0 XMLRPC_REQUIRED=1.14.0 @@ -1641,6 +1642,38 @@ AM_CONDITIONAL([WITH_NETCF], [test "$wit AC_SUBST([NETCF_CFLAGS]) AC_SUBST([NETCF_LIBS]) +AC_ARG_WITH([netcontrol], + AC_HELP_STRING([--with-netcontrol], [SUSE netcontrol support to configure physical host network interfaces @<:@default=check@:>@]), + [], + [test "$with_netcontrol" = "yes" && with_netcontrol=no || with_netcontrol=check]) + +NETCONTROL_CFLAGS= +NETCONTROL_LIBS= +if test "$with_netcf" = "yes"; then + if test "$with_netcontrol" = "yes" || test "$with_netcontrol" = "check"; then + AC_MSG_WARN([netcf and netcontrol cannot be used together, disabling netcontrol]) + with_netcontrol=no + fi +fi + +if test "$with_netcontrol" = "yes" || test "$with_netcontrol" = "check"; then + PKG_CHECK_MODULES(NETCONTROL, netcontrol >= $NETCONTROL_REQUIRED, + [with_netcontrol=yes], [ + if test "$with_netcontrol" = "check" ; then + with_netcontrol=no + else + AC_MSG_ERROR( + [You must install netcontrol >= $NETCONTROL_REQUIRED to compile libvirt]) + fi + ]) + if test "$with_netcontrol" = "yes" ; then + AC_DEFINE_UNQUOTED([WITH_NETCONTROL], 1, + [whether libnetcontrol is available to configure physical host network interfaces]) + fi +fi +AM_CONDITIONAL([WITH_NETCONTROL], [test "$with_netcontrol" = "yes"]) +AC_SUBST([NETCONTROL_CFLAGS]) +AC_SUBST([NETCONTROL_LIBS]) AC_ARG_WITH([secrets], AC_HELP_STRING([--with-secrets], [with local secrets management driver @<:@default=yes@:>@]),[],[with_secrets=yes]) @@ -2592,6 +2625,7 @@ AC_MSG_NOTICE([ Remote: $with_remote]) AC_MSG_NOTICE([ Network: $with_network]) AC_MSG_NOTICE([Libvirtd: $with_libvirtd]) AC_MSG_NOTICE([ netcf: $with_netcf]) +AC_MSG_NOTICE([ netctrl: $with_netcontrol]) AC_MSG_NOTICE([ macvtap: $with_macvtap]) AC_MSG_NOTICE([virtport: $with_virtualport]) AC_MSG_NOTICE([]) @@ -2723,6 +2757,11 @@ AC_MSG_NOTICE([ netcf: $NETCF_CFLAGS $ else AC_MSG_NOTICE([ netcf: no]) fi +if test "$with_netcontrol" = "yes" ; then +AC_MSG_NOTICE([ netctrl: $NETCONTROL_CFLAGS $NETCONTROL_LIBS]) +else +AC_MSG_NOTICE([ netctrl: no]) +fi if test "$with_qemu" = "yes" && test "$LIBPCAP_FOUND" != "no"; then AC_MSG_NOTICE([ pcap: $LIBPCAP_CFLAGS $LIBPCAP_LIBS]) else Index: libvirt-0.9.10/daemon/Makefile.am =================================================================== --- libvirt-0.9.10.orig/daemon/Makefile.am +++ libvirt-0.9.10/daemon/Makefile.am @@ -143,6 +143,10 @@ endif if WITH_NETCF libvirtd_LDADD += ../src/libvirt_driver_interface.la +else +if WITH_NETCONTROL + libvirtd_LDADD += ../src/libvirt_driver_interface.la +endif endif if WITH_NODE_DEVICES Index: libvirt-0.9.10/daemon/libvirtd.c =================================================================== --- libvirt-0.9.10.orig/daemon/libvirtd.c +++ libvirt-0.9.10/daemon/libvirtd.c @@ -75,6 +75,10 @@ # endif # ifdef WITH_NETCF # include "interface/netcf_driver.h" +# else +# ifdef WITH_NETCONTROL +# include "interface/netcf_driver.h" +# endif # endif # ifdef WITH_STORAGE_DIR # include "storage/storage_driver.h" @@ -414,6 +418,10 @@ static void daemonInitialize(void) # endif # ifdef WITH_NETCF interfaceRegister(); +#else +# ifdef WITH_NETCONTROL + interfaceRegister(); +# endif # endif # ifdef WITH_STORAGE_DIR storageRegister(); Index: libvirt-0.9.10/src/Makefile.am =================================================================== --- libvirt-0.9.10.orig/src/Makefile.am +++ libvirt-0.9.10/src/Makefile.am @@ -960,6 +960,24 @@ libvirt_driver_interface_la_LIBADD += .. libvirt_driver_interface_la_LDFLAGS += -module -avoid-version endif libvirt_driver_interface_la_SOURCES = $(INTERFACE_DRIVER_SOURCES) +else +if WITH_NETCONTROL +if WITH_DRIVER_MODULES +mod_LTLIBRARIES += libvirt_driver_interface.la +else +noinst_LTLIBRARIES += libvirt_driver_interface.la +libvirt_la_BUILT_LIBADD += libvirt_driver_interface.la +endif +libvirt_driver_interface_la_CFLAGS = $(NETCONTROL_CFLAGS) \ + -I@top_srcdir@/src/conf $(AM_CFLAGS) +libvirt_driver_interface_la_LDFLAGS = $(AM_LDFLAGS) +libvirt_driver_interface_la_LIBADD = $(NETCONTROL_LIBS) +if WITH_DRIVER_MODULES +libvirt_driver_interface_la_LIBADD += ../gnulib/lib/libgnu.la +libvirt_driver_interface_la_LDFLAGS += -module -avoid-version +endif +libvirt_driver_interface_la_SOURCES = $(INTERFACE_DRIVER_SOURCES) +endif endif if WITH_SECRETS Index: libvirt-0.9.10/src/interface/netcf_driver.c =================================================================== --- libvirt-0.9.10.orig/src/interface/netcf_driver.c +++ libvirt-0.9.10/src/interface/netcf_driver.c @@ -23,7 +23,13 @@ #include +#ifdef WITH_NETCONTROL +#include +#include +#include "logging.h" +#else #include +#endif #include "virterror_internal.h" #include "datatypes.h" @@ -55,6 +61,39 @@ static void interfaceDriverUnlock(struct virMutexUnlock(&driver->lock); } +#ifdef WITH_NETCONTROL +static void interface_nc_log_driver(const char *category, + int priority, + const char *func, + const char *file ATTRIBUTE_UNUSED, + long long line, + const char *msg, + size_t len ATTRIBUTE_UNUSED) +{ + int vp; + const char *vc; + + switch(priority) { + case NC_LOG_FATAL: + case NC_LOG_ERROR: + vp = VIR_LOG_ERROR; + break; + case NC_LOG_WARN: + vp = VIR_LOG_WARN; + break; + case NC_LOG_INFO: + vp = VIR_LOG_INFO; + break; + case NC_LOG_DEBUG: + default: + vp = VIR_LOG_DEBUG; + break; + } + vc = category ? category : "netcontrol"; + virLogMessage(vc, vp, func, line, 0, "%s", msg); +} +#endif + static int netcf_to_vir_err(int netcf_errcode) { switch (netcf_errcode) @@ -140,6 +179,10 @@ static virDrvOpenStatus interfaceOpenInt goto mutex_error; } +#ifdef WITH_NETCONTROL + nc_logger_redirect_to(interface_nc_log_driver); +#endif + /* open netcf */ if (ncf_init(&driverState->netcf, NULL) != 0) { Index: libvirt-0.9.10/tools/virsh.c =================================================================== --- libvirt-0.9.10.orig/tools/virsh.c +++ libvirt-0.9.10/tools/virsh.c @@ -19067,6 +19067,10 @@ vshShowVersion(vshControl *ctl ATTRIBUTE #endif #ifdef WITH_NETCF vshPrint(ctl, " Netcf"); +#else +#ifdef WITH_NETCONTROL + vshPrint(ctl, " NetControl"); +#endif #endif #ifdef WITH_NWFILTER vshPrint(ctl, " Nwfilter");