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