forked from pool/libvirt
enabled building with libnetcontrol
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=155
This commit is contained in:
parent
483e1d7f4a
commit
068fbe5b30
225
libvirt-suse-netcontrol.patch
Normal file
225
libvirt-suse-netcontrol.patch
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
Index: libvirt-0.9.4/configure.ac
|
||||||
|
===================================================================
|
||||||
|
--- libvirt-0.9.4.orig/configure.ac
|
||||||
|
+++ libvirt-0.9.4/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
|
||||||
|
@@ -1591,6 +1592,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])
|
||||||
|
@@ -2460,6 +2493,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([])
|
||||||
|
@@ -2586,6 +2620,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.4/daemon/Makefile.am
|
||||||
|
===================================================================
|
||||||
|
--- libvirt-0.9.4.orig/daemon/Makefile.am
|
||||||
|
+++ libvirt-0.9.4/daemon/Makefile.am
|
||||||
|
@@ -141,6 +141,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.4/daemon/libvirtd.c
|
||||||
|
===================================================================
|
||||||
|
--- libvirt-0.9.4.orig/daemon/libvirtd.c
|
||||||
|
+++ libvirt-0.9.4/daemon/libvirtd.c
|
||||||
|
@@ -74,6 +74,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"
|
||||||
|
@@ -428,6 +432,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.4/src/Makefile.am
|
||||||
|
===================================================================
|
||||||
|
--- libvirt-0.9.4.orig/src/Makefile.am
|
||||||
|
+++ libvirt-0.9.4/src/Makefile.am
|
||||||
|
@@ -870,6 +870,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.4/src/interface/netcf_driver.c
|
||||||
|
===================================================================
|
||||||
|
--- libvirt-0.9.4.orig/src/interface/netcf_driver.c
|
||||||
|
+++ libvirt-0.9.4/src/interface/netcf_driver.c
|
||||||
|
@@ -23,7 +23,13 @@
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
+#ifdef WITH_NETCONTROL
|
||||||
|
+#include <netcontrol/netcf.h>
|
||||||
|
+#include <netcontrol/logger.h>
|
||||||
|
+#include "logging.h"
|
||||||
|
+#else
|
||||||
|
#include <netcf.h>
|
||||||
|
+#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.4/tools/virsh.c
|
||||||
|
===================================================================
|
||||||
|
--- libvirt-0.9.4.orig/tools/virsh.c
|
||||||
|
+++ libvirt-0.9.4/tools/virsh.c
|
||||||
|
@@ -14904,6 +14904,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");
|
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Sep 16 12:50:51 MDT 2011 - jfehlig@suse.com
|
||||||
|
|
||||||
|
- Enable building with libnetcontrol
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Sep 16 12:02:37 UTC 2011 - jengelh@medozas.de
|
Fri Sep 16 12:02:37 UTC 2011 - jengelh@medozas.de
|
||||||
|
|
||||||
|
19
libvirt.spec
19
libvirt.spec
@ -66,6 +66,7 @@
|
|||||||
# A few optional bits off by default, we enable later
|
# A few optional bits off by default, we enable later
|
||||||
%define with_capng 0%{!?_without_capng:0}
|
%define with_capng 0%{!?_without_capng:0}
|
||||||
%define with_netcf 0%{!?_without_netcf:0}
|
%define with_netcf 0%{!?_without_netcf:0}
|
||||||
|
%define with_netcontrol 0%{!?_without_netcontrol:0}
|
||||||
%define with_udev 0%{!?_without_udev:0}
|
%define with_udev 0%{!?_without_udev:0}
|
||||||
%define with_hal 0%{!?_without_hal:0}
|
%define with_hal 0%{!?_without_hal:0}
|
||||||
%define with_yajl 0%{!?_without_yajl:0}
|
%define with_yajl 0%{!?_without_yajl:0}
|
||||||
@ -128,6 +129,11 @@
|
|||||||
%define with_hal 0%{!?_without_hal:%{server_drivers}}
|
%define with_hal 0%{!?_without_hal:%{server_drivers}}
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
# netcontrol is used to manage network interfaces on openSUSE >= 12.1
|
||||||
|
%if 0%{?suse_version} >= 1210
|
||||||
|
%define with_netcontrol 0%{!?_without_netcontrol:%{server_drivers}}
|
||||||
|
%endif
|
||||||
|
|
||||||
# libcapng is used to manage capabilities in 11.3 or newer.
|
# libcapng is used to manage capabilities in 11.3 or newer.
|
||||||
# It is also used by lxc and needs to be enabled if lxc is enabled.
|
# It is also used by lxc and needs to be enabled if lxc is enabled.
|
||||||
%if 0%{?suse_version} >= 1130 || %{with_lxc}
|
%if 0%{?suse_version} >= 1130 || %{with_lxc}
|
||||||
@ -249,6 +255,9 @@ BuildRequires: libcap-ng-devel >= 0.5.0
|
|||||||
%if %{with_netcf}
|
%if %{with_netcf}
|
||||||
BuildRequires: netcf-devel >= 0.1.4
|
BuildRequires: netcf-devel >= 0.1.4
|
||||||
%endif
|
%endif
|
||||||
|
%if %{with_netcontrol}
|
||||||
|
BuildRequires: libnetcontrol-devel >= 0.2.0
|
||||||
|
%endif
|
||||||
%if %{with_network}
|
%if %{with_network}
|
||||||
BuildRequires: dnsmasq >= 2.41
|
BuildRequires: dnsmasq >= 2.41
|
||||||
BuildRequires: iptables-devel
|
BuildRequires: iptables-devel
|
||||||
@ -384,6 +393,9 @@ Patch201: use-init-script-redhat.patch
|
|||||||
%if %{with_apparmor}
|
%if %{with_apparmor}
|
||||||
Patch250: install-apparmor-profiles.patch
|
Patch250: install-apparmor-profiles.patch
|
||||||
%endif
|
%endif
|
||||||
|
%if %{with_netcontrol}
|
||||||
|
Patch300: libvirt-suse-netcontrol.patch
|
||||||
|
%endif
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -513,6 +525,9 @@ Authors:
|
|||||||
%if %{with_apparmor}
|
%if %{with_apparmor}
|
||||||
%patch250 -p1
|
%patch250 -p1
|
||||||
%endif
|
%endif
|
||||||
|
%if %{with_netcontrol}
|
||||||
|
%patch300 -p1
|
||||||
|
%endif
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%if ! %{with_xen}
|
%if ! %{with_xen}
|
||||||
@ -581,6 +596,9 @@ Authors:
|
|||||||
%if ! %{with_netcf}
|
%if ! %{with_netcf}
|
||||||
%define _without_netcf --without-netcf
|
%define _without_netcf --without-netcf
|
||||||
%endif
|
%endif
|
||||||
|
%if ! %{with_netcontrol}
|
||||||
|
%define _without_netcontrol --without-netcontrol
|
||||||
|
%endif
|
||||||
%if ! %{with_hal}
|
%if ! %{with_hal}
|
||||||
%define _without_hal --without-hal
|
%define _without_hal --without-hal
|
||||||
%endif
|
%endif
|
||||||
@ -637,6 +655,7 @@ export CFLAGS="$RPM_OPT_FLAGS"
|
|||||||
%{?_without_apparmor} \
|
%{?_without_apparmor} \
|
||||||
%{?_without_capng} \
|
%{?_without_capng} \
|
||||||
%{?_without_netcf} \
|
%{?_without_netcf} \
|
||||||
|
%{?_without_netcontrol} \
|
||||||
%{?_without_hal} \
|
%{?_without_hal} \
|
||||||
%{?_without_udev} \
|
%{?_without_udev} \
|
||||||
%{?_without_yajl} \
|
%{?_without_yajl} \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user