summary refs log tree commit diff
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2015-12-03 11:05:19 +0100
committerDomen Kožar <domen@dev.si>2015-12-03 11:09:54 +0100
commita4fc362c54bed3e28bf3b9170838dbb410f8efbc (patch)
tree583fb0faa48596b8949d6d9f24bc38695f1af4ab
parent4abb515c6ed479c2dab20317ad8ba66a4593e1da (diff)
downloadnixpkgs-a4fc362c54bed3e28bf3b9170838dbb410f8efbc.tar
nixpkgs-a4fc362c54bed3e28bf3b9170838dbb410f8efbc.tar.gz
nixpkgs-a4fc362c54bed3e28bf3b9170838dbb410f8efbc.tar.bz2
nixpkgs-a4fc362c54bed3e28bf3b9170838dbb410f8efbc.tar.lz
nixpkgs-a4fc362c54bed3e28bf3b9170838dbb410f8efbc.tar.xz
nixpkgs-a4fc362c54bed3e28bf3b9170838dbb410f8efbc.tar.zst
nixpkgs-a4fc362c54bed3e28bf3b9170838dbb410f8efbc.zip
neutron: patch for iproute 4.x compatibility
-rw-r--r--pkgs/applications/virtualization/openstack/neutron-iproute-4.patch93
-rw-r--r--pkgs/applications/virtualization/openstack/neutron.nix7
2 files changed, 97 insertions, 3 deletions
diff --git a/pkgs/applications/virtualization/openstack/neutron-iproute-4.patch b/pkgs/applications/virtualization/openstack/neutron-iproute-4.patch
new file mode 100644
index 00000000000..d7a2caa2bde
--- /dev/null
+++ b/pkgs/applications/virtualization/openstack/neutron-iproute-4.patch
@@ -0,0 +1,93 @@
+From 3aefdf4de76fdcdc02093bc631e339f9ecd4c707 Mon Sep 17 00:00:00 2001
+From: James Page <james.page@ubuntu.com>
+Date: Fri, 18 Sep 2015 16:38:47 +0100
+Subject: Add compatibility with iproute2 >= 4.0
+
+The ip netns list command adds additional id data in more recent
+versions of iproute2 of the format:
+
+  qdhcp-35fc068a-750d-4add-b1d2-af392dbd8790 (id: 1)
+
+Update parsing to deal with old and new formats.
+
+Change-Id: I0d3fc4262284172f5ad31e4f2f78ae1fb33b4228
+Closes-Bug: 1497309
+---
+ neutron/agent/linux/ip_lib.py                   |  6 +++---
+ neutron/tests/functional/agent/test_l3_agent.py |  2 +-
+ neutron/tests/unit/agent/linux/test_ip_lib.py   | 15 +++++++++++++++
+ 3 files changed, 19 insertions(+), 4 deletions(-)
+
+diff --git a/neutron/agent/linux/ip_lib.py b/neutron/agent/linux/ip_lib.py
+index 551341a..a717bf6 100644
+--- a/neutron/agent/linux/ip_lib.py
++++ b/neutron/agent/linux/ip_lib.py
+@@ -208,7 +208,7 @@ class IPWrapper(SubProcessBase):
+     @classmethod
+     def get_namespaces(cls):
+         output = cls._execute([], 'netns', ('list',))
+-        return [l.strip() for l in output.split('\n')]
++        return [l.split()[0] for l in output.splitlines()]
+ 
+ 
+ class IPDevice(SubProcessBase):
+@@ -819,8 +819,8 @@ class IpNetnsCommand(IpCommandBase):
+         output = self._parent._execute(
+             ['o'], 'netns', ['list'],
+             run_as_root=cfg.CONF.AGENT.use_helper_for_ns_read)
+-        for line in output.split('\n'):
+-            if name == line.strip():
++        for line in [l.split()[0] for l in output.splitlines()]:
++            if name == line:
+                 return True
+         return False
+ 
+diff --git a/neutron/tests/functional/agent/test_l3_agent.py b/neutron/tests/functional/agent/test_l3_agent.py
+index ffa20e6..84b16df 100644
+--- a/neutron/tests/functional/agent/test_l3_agent.py
++++ b/neutron/tests/functional/agent/test_l3_agent.py
+@@ -790,7 +790,7 @@ class L3HATestFramework(L3AgentTestFramework):
+         get_ns_name = mock.patch.object(
+             namespaces.RouterNamespace, '_get_ns_name').start()
+         get_ns_name.return_value = "%s%s%s" % (
+-            namespaces.RouterNamespace._get_ns_name(router_info['id']),
++            'qrouter-' + router_info['id'],
+             self.NESTED_NAMESPACE_SEPARATOR, self.agent.host)
+         router1 = self.manage_router(self.agent, router_info)
+ 
+diff --git a/neutron/tests/unit/agent/linux/test_ip_lib.py b/neutron/tests/unit/agent/linux/test_ip_lib.py
+index 2de408d..bdfc9d7 100644
+--- a/neutron/tests/unit/agent/linux/test_ip_lib.py
++++ b/neutron/tests/unit/agent/linux/test_ip_lib.py
+@@ -27,6 +27,11 @@ NETNS_SAMPLE = [
+     'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb',
+     'cccccccc-cccc-cccc-cccc-cccccccccccc']
+ 
++NETNS_SAMPLE_IPROUTE2_4 = [
++    '12345678-1234-5678-abcd-1234567890ab (id: 1)',
++    'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb (id: 0)',
++    'cccccccc-cccc-cccc-cccc-cccccccccccc (id: 2)']
++
+ LINK_SAMPLE = [
+     '1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN \\'
+     'link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 promiscuity 0',
+@@ -279,6 +284,16 @@ class TestIpWrapper(base.BaseTestCase):
+ 
+         self.execute.assert_called_once_with([], 'netns', ('list',))
+ 
++    def test_get_namespaces_iproute2_4(self):
++        self.execute.return_value = '\n'.join(NETNS_SAMPLE_IPROUTE2_4)
++        retval = ip_lib.IPWrapper.get_namespaces()
++        self.assertEqual(retval,
++                         ['12345678-1234-5678-abcd-1234567890ab',
++                          'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb',
++                          'cccccccc-cccc-cccc-cccc-cccccccccccc'])
++
++        self.execute.assert_called_once_with([], 'netns', ('list',))
++
+     def test_add_tuntap(self):
+         ip_lib.IPWrapper().add_tuntap('tap0')
+         self.execute.assert_called_once_with([], 'tuntap',
+-- 
+cgit v0.11.2
+
diff --git a/pkgs/applications/virtualization/openstack/neutron.nix b/pkgs/applications/virtualization/openstack/neutron.nix
index ce3e71b16ee..ce44ed2913c 100644
--- a/pkgs/applications/virtualization/openstack/neutron.nix
+++ b/pkgs/applications/virtualization/openstack/neutron.nix
@@ -1,5 +1,4 @@
-
-{ stdenv, fetchurl, pythonPackages, xmlsec, which }:
+{ stdenv, fetchurl, pythonPackages, xmlsec, which, dnsmasq }:
 
 pythonPackages.buildPythonPackage rec {
   name = "neutron-${version}";
@@ -29,9 +28,11 @@ pythonPackages.buildPythonPackage rec {
   ];
 
   # make sure we include migrations
-  patchPhase = ''
+  prePatch = ''
     echo "graft neutron" >> MANIFEST.in
+    substituteInPlace etc/neutron/rootwrap.d/dhcp.filters --replace "/sbin/dnsmasq" "${dnsmasq}/bin/dnsmasq"
   '';
+  patches = [ ./neutron-iproute-4.patch ];
 
   buildInputs = with pythonPackages; [
     cliff coverage fixtures mock subunit requests-mock oslosphinx testrepository