From 810ca6c2075494293329e63dc9055c1f5ec57f04 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Fri, 11 Apr 2014 15:53:56 -0400 Subject: [PATCH] Fix LXC from throwing error System lacks NETNS support (bz #1084902) --- ...ode-evaulation-in-lxcCheckNetNsSuppo.patch | 33 +++++++++++++++++++ libvirt.spec | 11 ++++++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 0001-LXC-Fix-return-code-evaulation-in-lxcCheckNetNsSuppo.patch diff --git a/0001-LXC-Fix-return-code-evaulation-in-lxcCheckNetNsSuppo.patch b/0001-LXC-Fix-return-code-evaulation-in-lxcCheckNetNsSuppo.patch new file mode 100644 index 0000000..33f7b94 --- /dev/null +++ b/0001-LXC-Fix-return-code-evaulation-in-lxcCheckNetNsSuppo.patch @@ -0,0 +1,33 @@ +From 21ec87f4f1a538f929c48ecb2bdbf48701022779 Mon Sep 17 00:00:00 2001 +Message-Id: <21ec87f4f1a538f929c48ecb2bdbf48701022779.1397245564.git.crobinso@redhat.com> +From: Richard Weinberger +Date: Tue, 8 Apr 2014 14:26:26 +0200 +Subject: [PATCH] LXC: Fix return code evaulation in lxcCheckNetNsSupport() + +Commit b9dd878f (util: make it easier to grab only regular command exit) +changed the call semantics of virCommandRun() and therefore of virRun() +too. But lxcCheckNetNsSupport() was not updated. +As consequence of this lxcCheckNetNsSupport always failed and broke LXC. + +Signed-off-by: Richard Weinberger +--- + src/lxc/lxc_driver.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c +index 33ff011..942e139 100644 +--- a/src/lxc/lxc_driver.c ++++ b/src/lxc/lxc_driver.c +@@ -1475,8 +1475,7 @@ static int lxcCheckNetNsSupport(void) + const char *argv[] = {"ip", "link", "set", "lo", "netns", "-1", NULL}; + int ip_rc; + +- if (virRun(argv, &ip_rc) < 0 || +- !(WIFEXITED(ip_rc) && (WEXITSTATUS(ip_rc) != 255))) ++ if (virRun(argv, &ip_rc) < 0 || ip_rc == 255) + return 0; + + if (lxcContainerAvailable(LXC_CONTAINER_FEATURE_NET) < 0) +-- +1.9.0 + diff --git a/libvirt.spec b/libvirt.spec index 4ed7cdc..5cf66a4 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -388,7 +388,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 1.2.3 -Release: 1%{?dist}%{?extra_release} +Release: 2%{?dist}%{?extra_release} License: LGPLv2+ Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -399,6 +399,9 @@ URL: http://libvirt.org/ %endif Source: http://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.gz +# Fix LXC from throwing error System lacks NETNS support (bz #1084902) +Patch0001: 0001-LXC-Fix-return-code-evaulation-in-lxcCheckNetNsSuppo.patch + %if %{with_libvirtd} Requires: libvirt-daemon = %{version}-%{release} %if %{with_network} @@ -1206,6 +1209,9 @@ driver %prep %setup -q +# Fix LXC from throwing error System lacks NETNS support (bz #1084902) +%patch0001 -p1 + %build %if ! %{with_xen} %define _without_xen --without-xen @@ -2220,6 +2226,9 @@ exit 0 %doc examples/systemtap %changelog +* Fri Apr 11 2014 Cole Robinson - 1.2.3-2 +- Fix LXC from throwing error System lacks NETNS support (bz #1084902) + * Tue Apr 01 2014 Cole Robinson - 1.2.3-1 - Rebased to version 1.2.3