neutron: patch for iproute 4.x compatibility

+97 -3
+93
pkgs/applications/virtualization/openstack/neutron-iproute-4.patch
··· 1 + From 3aefdf4de76fdcdc02093bc631e339f9ecd4c707 Mon Sep 17 00:00:00 2001 2 + From: James Page <james.page@ubuntu.com> 3 + Date: Fri, 18 Sep 2015 16:38:47 +0100 4 + Subject: Add compatibility with iproute2 >= 4.0 5 + 6 + The ip netns list command adds additional id data in more recent 7 + versions of iproute2 of the format: 8 + 9 + qdhcp-35fc068a-750d-4add-b1d2-af392dbd8790 (id: 1) 10 + 11 + Update parsing to deal with old and new formats. 12 + 13 + Change-Id: I0d3fc4262284172f5ad31e4f2f78ae1fb33b4228 14 + Closes-Bug: 1497309 15 + --- 16 + neutron/agent/linux/ip_lib.py | 6 +++--- 17 + neutron/tests/functional/agent/test_l3_agent.py | 2 +- 18 + neutron/tests/unit/agent/linux/test_ip_lib.py | 15 +++++++++++++++ 19 + 3 files changed, 19 insertions(+), 4 deletions(-) 20 + 21 + diff --git a/neutron/agent/linux/ip_lib.py b/neutron/agent/linux/ip_lib.py 22 + index 551341a..a717bf6 100644 23 + --- a/neutron/agent/linux/ip_lib.py 24 + +++ b/neutron/agent/linux/ip_lib.py 25 + @@ -208,7 +208,7 @@ class IPWrapper(SubProcessBase): 26 + @classmethod 27 + def get_namespaces(cls): 28 + output = cls._execute([], 'netns', ('list',)) 29 + - return [l.strip() for l in output.split('\n')] 30 + + return [l.split()[0] for l in output.splitlines()] 31 + 32 + 33 + class IPDevice(SubProcessBase): 34 + @@ -819,8 +819,8 @@ class IpNetnsCommand(IpCommandBase): 35 + output = self._parent._execute( 36 + ['o'], 'netns', ['list'], 37 + run_as_root=cfg.CONF.AGENT.use_helper_for_ns_read) 38 + - for line in output.split('\n'): 39 + - if name == line.strip(): 40 + + for line in [l.split()[0] for l in output.splitlines()]: 41 + + if name == line: 42 + return True 43 + return False 44 + 45 + diff --git a/neutron/tests/functional/agent/test_l3_agent.py b/neutron/tests/functional/agent/test_l3_agent.py 46 + index ffa20e6..84b16df 100644 47 + --- a/neutron/tests/functional/agent/test_l3_agent.py 48 + +++ b/neutron/tests/functional/agent/test_l3_agent.py 49 + @@ -790,7 +790,7 @@ class L3HATestFramework(L3AgentTestFramework): 50 + get_ns_name = mock.patch.object( 51 + namespaces.RouterNamespace, '_get_ns_name').start() 52 + get_ns_name.return_value = "%s%s%s" % ( 53 + - namespaces.RouterNamespace._get_ns_name(router_info['id']), 54 + + 'qrouter-' + router_info['id'], 55 + self.NESTED_NAMESPACE_SEPARATOR, self.agent.host) 56 + router1 = self.manage_router(self.agent, router_info) 57 + 58 + diff --git a/neutron/tests/unit/agent/linux/test_ip_lib.py b/neutron/tests/unit/agent/linux/test_ip_lib.py 59 + index 2de408d..bdfc9d7 100644 60 + --- a/neutron/tests/unit/agent/linux/test_ip_lib.py 61 + +++ b/neutron/tests/unit/agent/linux/test_ip_lib.py 62 + @@ -27,6 +27,11 @@ NETNS_SAMPLE = [ 63 + 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 64 + 'cccccccc-cccc-cccc-cccc-cccccccccccc'] 65 + 66 + +NETNS_SAMPLE_IPROUTE2_4 = [ 67 + + '12345678-1234-5678-abcd-1234567890ab (id: 1)', 68 + + 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb (id: 0)', 69 + + 'cccccccc-cccc-cccc-cccc-cccccccccccc (id: 2)'] 70 + + 71 + LINK_SAMPLE = [ 72 + '1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN \\' 73 + 'link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 promiscuity 0', 74 + @@ -279,6 +284,16 @@ class TestIpWrapper(base.BaseTestCase): 75 + 76 + self.execute.assert_called_once_with([], 'netns', ('list',)) 77 + 78 + + def test_get_namespaces_iproute2_4(self): 79 + + self.execute.return_value = '\n'.join(NETNS_SAMPLE_IPROUTE2_4) 80 + + retval = ip_lib.IPWrapper.get_namespaces() 81 + + self.assertEqual(retval, 82 + + ['12345678-1234-5678-abcd-1234567890ab', 83 + + 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 84 + + 'cccccccc-cccc-cccc-cccc-cccccccccccc']) 85 + + 86 + + self.execute.assert_called_once_with([], 'netns', ('list',)) 87 + + 88 + def test_add_tuntap(self): 89 + ip_lib.IPWrapper().add_tuntap('tap0') 90 + self.execute.assert_called_once_with([], 'tuntap', 91 + -- 92 + cgit v0.11.2 93 +
+4 -3
pkgs/applications/virtualization/openstack/neutron.nix
··· 1 - 2 - { stdenv, fetchurl, pythonPackages, xmlsec, which }: 1 + { stdenv, fetchurl, pythonPackages, xmlsec, which, dnsmasq }: 3 2 4 3 pythonPackages.buildPythonPackage rec { 5 4 name = "neutron-${version}"; ··· 29 28 ]; 30 29 31 30 # make sure we include migrations 32 - patchPhase = '' 31 + prePatch = '' 33 32 echo "graft neutron" >> MANIFEST.in 33 + substituteInPlace etc/neutron/rootwrap.d/dhcp.filters --replace "/sbin/dnsmasq" "${dnsmasq}/bin/dnsmasq" 34 34 ''; 35 + patches = [ ./neutron-iproute-4.patch ]; 35 36 36 37 buildInputs = with pythonPackages; [ 37 38 cliff coverage fixtures mock subunit requests-mock oslosphinx testrepository