forked from pool/libvirt
f7dcb464bc
- Update to libvirt 5.10.0 - bsc#1157149 - Many incremental improvements and bug fixes, see https://libvirt.org/news.html - Dropped patches: 2552752f-libxl-fix-lock-manager-lock-ordering.patch - Added patches: 0a65cba4-news-fix.patch OBS-URL: https://build.opensuse.org/request/show/753075 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=786
246 lines
8.1 KiB
Diff
246 lines
8.1 KiB
Diff
Index: libvirt-5.10.0/configure.ac
|
|
===================================================================
|
|
--- libvirt-5.10.0.orig/configure.ac
|
|
+++ libvirt-5.10.0/configure.ac
|
|
@@ -285,6 +285,7 @@ LIBVIRT_ARG_LIBSSH
|
|
LIBVIRT_ARG_LIBXML
|
|
LIBVIRT_ARG_MACVTAP
|
|
LIBVIRT_ARG_NETCF
|
|
+LIBVIRT_ARG_NETCONTROL
|
|
LIBVIRT_ARG_NLS
|
|
LIBVIRT_ARG_NSS
|
|
LIBVIRT_ARG_NUMACTL
|
|
@@ -329,6 +330,7 @@ LIBVIRT_CHECK_LIBSSH
|
|
LIBVIRT_CHECK_LIBXML
|
|
LIBVIRT_CHECK_MACVTAP
|
|
LIBVIRT_CHECK_NETCF
|
|
+LIBVIRT_CHECK_NETCONTROL
|
|
LIBVIRT_CHECK_NLS
|
|
LIBVIRT_CHECK_NUMACTL
|
|
LIBVIRT_CHECK_NWFILTER
|
|
@@ -1015,6 +1017,7 @@ LIBVIRT_RESULT_LIBXL
|
|
LIBVIRT_RESULT_LIBXML
|
|
LIBVIRT_RESULT_MACVTAP
|
|
LIBVIRT_RESULT_NETCF
|
|
+LIBVIRT_RESULT_NETCONTROL
|
|
LIBVIRT_RESULT_NLS
|
|
LIBVIRT_RESULT_NSS
|
|
LIBVIRT_RESULT_NUMACTL
|
|
Index: libvirt-5.10.0/tools/virsh.c
|
|
===================================================================
|
|
--- libvirt-5.10.0.orig/tools/virsh.c
|
|
+++ libvirt-5.10.0/tools/virsh.c
|
|
@@ -555,6 +555,8 @@ virshShowVersion(vshControl *ctl G_GNUC_
|
|
vshPrint(ctl, " Interface");
|
|
# if defined(WITH_NETCF)
|
|
vshPrint(ctl, " netcf");
|
|
+# elif defined(WITH_NETCONTROL)
|
|
+ vshPrint(ctl, " netcontrol");
|
|
# elif defined(WITH_UDEV)
|
|
vshPrint(ctl, " udev");
|
|
# endif
|
|
Index: libvirt-5.10.0/src/interface/interface_backend_netcf.c
|
|
===================================================================
|
|
--- libvirt-5.10.0.orig/src/interface/interface_backend_netcf.c
|
|
+++ libvirt-5.10.0/src/interface/interface_backend_netcf.c
|
|
@@ -21,7 +21,12 @@
|
|
|
|
#include <config.h>
|
|
|
|
-#include <netcf.h>
|
|
+#ifdef WITH_NETCONTROL
|
|
+# include <netcontrol/netcf.h>
|
|
+# include <netcontrol/logger.h>
|
|
+#else
|
|
+# include <netcf.h>
|
|
+#endif
|
|
|
|
#include "virerror.h"
|
|
#include "datatypes.h"
|
|
@@ -71,6 +76,37 @@ VIR_ONCE_GLOBAL_INIT(virNetcfDriverState
|
|
|
|
static virNetcfDriverStatePtr driver;
|
|
|
|
+#ifdef WITH_NETCONTROL
|
|
+static void
|
|
+interface_nc_log_driver(const char *category ATTRIBUTE_UNUSED,
|
|
+ int priority,
|
|
+ const char *func,
|
|
+ const char *file,
|
|
+ long long line,
|
|
+ const char *msg,
|
|
+ size_t len ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ int vp;
|
|
+
|
|
+ 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;
|
|
+ }
|
|
+ virLogMessage(&virLogSelf, vp, file, line, func, 0, "%s", msg);
|
|
+}
|
|
+#endif
|
|
|
|
static void
|
|
virNetcfDriverStateDispose(void *obj)
|
|
@@ -120,6 +156,10 @@ netcfStateInitialize(bool privileged,
|
|
virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
|
|
goto error;
|
|
|
|
+#ifdef WITH_NETCONTROL
|
|
+ nc_logger_redirect_to(interface_nc_log_driver);
|
|
+#endif
|
|
+
|
|
/* open netcf */
|
|
if (ncf_init(&driver->netcf, NULL) != 0) {
|
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
@@ -1114,6 +1154,7 @@ static int netcfInterfaceIsActive(virInt
|
|
return ret;
|
|
}
|
|
|
|
+#ifdef HAVE_NETCF_TRANSACTIONS
|
|
static int netcfInterfaceChangeBegin(virConnectPtr conn, unsigned int flags)
|
|
{
|
|
int ret;
|
|
@@ -1188,6 +1229,7 @@ static int netcfInterfaceChangeRollback(
|
|
virObjectUnlock(driver);
|
|
return ret;
|
|
}
|
|
+#endif /* HAVE_NETCF_TRANSACTIONS */
|
|
|
|
static virInterfaceDriver interfaceDriver = {
|
|
.name = INTERFACE_DRIVER_NAME,
|
|
@@ -1204,9 +1246,11 @@ static virInterfaceDriver interfaceDrive
|
|
.interfaceCreate = netcfInterfaceCreate, /* 0.7.0 */
|
|
.interfaceDestroy = netcfInterfaceDestroy, /* 0.7.0 */
|
|
.interfaceIsActive = netcfInterfaceIsActive, /* 0.7.3 */
|
|
+#ifdef HAVE_NETCF_TRANSACTIONS
|
|
.interfaceChangeBegin = netcfInterfaceChangeBegin, /* 0.9.2 */
|
|
.interfaceChangeCommit = netcfInterfaceChangeCommit, /* 0.9.2 */
|
|
.interfaceChangeRollback = netcfInterfaceChangeRollback, /* 0.9.2 */
|
|
+#endif /* HAVE_NETCF_TRANSACTIONS */
|
|
};
|
|
|
|
|
|
@@ -1237,6 +1281,19 @@ static virStateDriver interfaceStateDriv
|
|
|
|
int netcfIfaceRegister(void)
|
|
{
|
|
+ struct netcf *netcf;
|
|
+
|
|
+ /* Initialization of libnetcontrol will fail if NetworkManager is enabled.
|
|
+ * Skip registration if ncf_init fails.
|
|
+ * TODO: finer-grained check? E.g. is_nm_enabled()
|
|
+ */
|
|
+ if (ncf_init(&netcf, NULL) != 0) {
|
|
+ VIR_WARN("Failed to initialize libnetcontrol. Management of interface devices is disabled");
|
|
+ return 0;
|
|
+ }
|
|
+
|
|
+ ncf_close(netcf);
|
|
+
|
|
if (virRegisterConnectDriver(&interfaceConnectDriver, false) < 0)
|
|
return -1;
|
|
if (virSetSharedInterfaceDriver(&interfaceDriver) < 0)
|
|
Index: libvirt-5.10.0/src/interface/interface_driver.c
|
|
===================================================================
|
|
--- libvirt-5.10.0.orig/src/interface/interface_driver.c
|
|
+++ libvirt-5.10.0/src/interface/interface_driver.c
|
|
@@ -30,8 +30,15 @@ interfaceRegister(void)
|
|
if (netcfIfaceRegister() == 0)
|
|
return 0;
|
|
#endif /* WITH_NETCF */
|
|
+#ifdef WITH_NETCONTROL
|
|
+ /* Attempt to load the netcontrol based backend, which is a slightly
|
|
+ patched netcf backend */
|
|
+ if (netcfIfaceRegister() == 0)
|
|
+ return 0;
|
|
+#endif /* WITH_NETCONTROL */
|
|
#if WITH_UDEV
|
|
- /* If there's no netcf or it failed to load, register the udev backend */
|
|
+ /* If there's no netcf or netcontrol, or it failed to load, register the
|
|
+ udev backend */
|
|
if (udevIfaceRegister() == 0)
|
|
return 0;
|
|
#endif /* WITH_UDEV */
|
|
Index: libvirt-5.10.0/m4/virt-netcontrol.m4
|
|
===================================================================
|
|
--- /dev/null
|
|
+++ libvirt-5.10.0/m4/virt-netcontrol.m4
|
|
@@ -0,0 +1,39 @@
|
|
+dnl The libnetcontrol library
|
|
+dnl
|
|
+dnl Copyright (C) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
|
+dnl
|
|
+dnl This library is free software; you can redistribute it and/or
|
|
+dnl modify it under the terms of the GNU Lesser General Public
|
|
+dnl License as published by the Free Software Foundation; either
|
|
+dnl version 2.1 of the License, or (at your option) any later version.
|
|
+dnl
|
|
+dnl This library is distributed in the hope that it will be useful,
|
|
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
+dnl Lesser General Public License for more details.
|
|
+dnl
|
|
+dnl You should have received a copy of the GNU Lesser General Public
|
|
+dnl License along with this library. If not, see
|
|
+dnl <http://www.gnu.org/licenses/>.
|
|
+dnl
|
|
+
|
|
+AC_DEFUN([LIBVIRT_ARG_NETCONTROL],[
|
|
+ LIBVIRT_ARG_WITH_FEATURE([NETCONTROL], [netcontrol], [check], [0.2.0])
|
|
+])
|
|
+
|
|
+AC_DEFUN([LIBVIRT_CHECK_NETCONTROL],[
|
|
+ LIBVIRT_CHECK_PKG([NETCONTROL], [netcontrol], [0.2.0])
|
|
+
|
|
+ if test "$with_netcontrol" = "yes" ; then
|
|
+ old_CFLAGS="$CFLAGS"
|
|
+ old_LIBS="$CFLAGS"
|
|
+ CFLAGS="$CFLAGS $NETCONTROL_CFLAGS"
|
|
+ LIBS="$LIBS $NETCONTROL_LIBS"
|
|
+ CFLAGS="$old_CFLAGS"
|
|
+ LIBS="$old_LIBS"
|
|
+ fi
|
|
+])
|
|
+
|
|
+AC_DEFUN([LIBVIRT_RESULT_NETCONTROL],[
|
|
+ LIBVIRT_RESULT_LIB([NETCONTROL])
|
|
+])
|
|
Index: libvirt-5.10.0/src/interface/Makefile.inc.am
|
|
===================================================================
|
|
--- libvirt-5.10.0.orig/src/interface/Makefile.inc.am
|
|
+++ libvirt-5.10.0/src/interface/Makefile.inc.am
|
|
@@ -6,6 +6,7 @@ INTERFACE_DRIVER_SOURCES = \
|
|
$(NULL)
|
|
|
|
INTERFACE_DRIVER_NETCF_SOURCES = interface/interface_backend_netcf.c
|
|
+INTERFACE_DRIVER_NETCONTROL_SOURCES = interface/interface_backend_netcf.c
|
|
INTERFACE_DRIVER_UDEV_SOURCES = interface/interface_backend_udev.c
|
|
|
|
DRIVER_SOURCE_FILES += $(addprefix $(srcdir)/,$(INTERFACE_DRIVER_SOURCES))
|
|
@@ -38,6 +39,11 @@ libvirt_driver_interface_la_CFLAGS += $(
|
|
libvirt_driver_interface_la_LIBADD += $(NETCF_LIBS)
|
|
libvirt_driver_interface_la_SOURCES += $(INTERFACE_DRIVER_NETCF_SOURCES)
|
|
endif WITH_NETCF
|
|
+if WITH_NETCONTROL
|
|
+libvirt_driver_interface_la_CFLAGS += $(NETCONTROL_CFLAGS)
|
|
+libvirt_driver_interface_la_LIBADD += $(NETCONTROL_LIBS)
|
|
+libvirt_driver_interface_la_SOURCES += $(INTERFACE_DRIVER_NETCONTROL_SOURCES)
|
|
+endif WITH_NETCONTROL
|
|
if WITH_UDEV
|
|
libvirt_driver_interface_la_CFLAGS += $(UDEV_CFLAGS)
|
|
libvirt_driver_interface_la_LIBADD += $(UDEV_LIBS)
|