Merge lp:~james-page/charms/precise/quantum-gateway/vmware-nsx into lp:charms/quantum-gateway

Proposed by James Page
Status: Superseded
Proposed branch: lp:~james-page/charms/precise/quantum-gateway/vmware-nsx
Merge into: lp:charms/quantum-gateway
Diff against target: 292 lines (+91/-17)
7 files modified
config.yaml (+1/-1)
hooks/quantum_contexts.py (+18/-3)
hooks/quantum_hooks.py (+3/-2)
hooks/quantum_utils.py (+19/-7)
templates/havana/dhcp_agent.ini (+1/-1)
unit_tests/test_quantum_contexts.py (+28/-2)
unit_tests/test_quantum_utils.py (+21/-1)
To merge this branch: bzr merge lp:~james-page/charms/precise/quantum-gateway/vmware-nsx
Reviewer Review Type Date Requested Status
OpenStack Charmers Pending
Review via email: mp+220426@code.launchpad.net

This proposal has been superseded by a proposal from 2014-06-02.

Description of the change

Fixup support for NSX (renamed from NVP) in Icehouse

To post a comment you must log in.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2014-04-10 16:50:13 +0000
3+++ config.yaml 2014-05-21 10:34:16 +0000
4@@ -7,7 +7,7 @@
5 Supported values include:
6 .
7 ovs - OpenVSwitch
8- nvp - Nicira NVP
9+ nvp|nsx - Nicira NVP/VMware NSX
10 ext-port:
11 type: string
12 description: |
13
14=== modified file 'hooks/quantum_contexts.py'
15--- hooks/quantum_contexts.py 2014-03-27 11:20:28 +0000
16+++ hooks/quantum_contexts.py 2014-05-21 10:34:16 +0000
17@@ -44,6 +44,8 @@
18 "neutron.plugins.ml2.plugin.Ml2Plugin"
19 NEUTRON_NVP_PLUGIN = \
20 "neutron.plugins.nicira.nicira_nvp_plugin.NeutronPlugin.NvpPluginV2"
21+NEUTRON_NSX_PLUGIN = "vmware"
22+
23 NEUTRON = 'neutron'
24 QUANTUM = 'quantum'
25
26@@ -57,6 +59,7 @@
27
28 OVS = 'ovs'
29 NVP = 'nvp'
30+NSX = 'nsx'
31
32 CORE_PLUGIN = {
33 QUANTUM: {
34@@ -65,18 +68,30 @@
35 },
36 NEUTRON: {
37 OVS: NEUTRON_OVS_PLUGIN,
38- NVP: NEUTRON_NVP_PLUGIN
39+ NVP: NEUTRON_NVP_PLUGIN,
40+ NSX: NEUTRON_NSX_PLUGIN
41 },
42 }
43
44
45+def remap_plugin(plugin):
46+ ''' Remaps plugin name for renames/switches in packaging '''
47+ release = get_os_codename_install_source(config('openstack-origin'))
48+ if plugin == 'nvp' and release >= 'icehouse':
49+ plugin = 'nsx'
50+ elif plugin == 'nsx' and release < 'icehouse':
51+ plugin = 'nvp'
52+ return plugin
53+
54+
55 def core_plugin():
56+ plugin = remap_plugin(config('plugin'))
57 if (get_os_codename_install_source(config('openstack-origin'))
58 >= 'icehouse'
59- and config('plugin') == OVS):
60+ and plugin == OVS):
61 return NEUTRON_ML2_PLUGIN
62 else:
63- return CORE_PLUGIN[networking_name()][config('plugin')]
64+ return CORE_PLUGIN[networking_name()][plugin]
65
66
67 class NetworkServiceContext(OSContextGenerator):
68
69=== modified file 'hooks/quantum_hooks.py'
70--- hooks/quantum_hooks.py 2014-04-10 13:45:11 +0000
71+++ hooks/quantum_hooks.py 2014-05-21 10:34:16 +0000
72@@ -161,8 +161,9 @@
73 @hooks.hook("cluster-relation-departed")
74 @restart_on_change(restart_map())
75 def cluster_departed():
76- if config('plugin') == 'nvp':
77- log('Unable to re-assign agent resources for failed nodes with nvp',
78+ if config('plugin') in ['nvp', 'nsx']:
79+ log('Unable to re-assign agent resources for'
80+ ' failed nodes with nvp|nsx',
81 level=WARNING)
82 return
83 if eligible_leader(None):
84
85=== modified file 'hooks/quantum_utils.py'
86--- hooks/quantum_utils.py 2014-04-10 16:50:13 +0000
87+++ hooks/quantum_utils.py 2014-05-21 10:34:16 +0000
88@@ -37,13 +37,14 @@
89 import charmhelpers.contrib.openstack.templating as templating
90 from charmhelpers.contrib.openstack.neutron import headers_package
91 from quantum_contexts import (
92- CORE_PLUGIN, OVS, NVP,
93+ CORE_PLUGIN, OVS, NVP, NSX,
94 NEUTRON, QUANTUM,
95 networking_name,
96 QuantumGatewayContext,
97 NetworkServiceContext,
98 L3AgentContext,
99 ExternalPortContext,
100+ remap_plugin
101 )
102
103 from copy import deepcopy
104@@ -71,9 +72,13 @@
105 "/etc/neutron/plugins/ml2/ml2_conf.ini"
106 NEUTRON_NVP_PLUGIN_CONF = \
107 "/etc/neutron/plugins/nicira/nvp.ini"
108+NEUTRON_NSX_PLUGIN_CONF = \
109+ "/etc/neutron/plugins/vmware/nsx.ini"
110+
111 NEUTRON_PLUGIN_CONF = {
112 OVS: NEUTRON_OVS_PLUGIN_CONF,
113- NVP: NEUTRON_NVP_PLUGIN_CONF
114+ NVP: NEUTRON_NVP_PLUGIN_CONF,
115+ NSX: NEUTRON_NSX_PLUGIN_CONF,
116 }
117
118 QUANTUM_GATEWAY_PKGS = {
119@@ -116,6 +121,7 @@
120 "nova-api-metadata"
121 ]
122 }
123+NEUTRON_GATEWAY_PKGS[NSX] = NEUTRON_GATEWAY_PKGS[NVP]
124
125 GATEWAY_PKGS = {
126 QUANTUM: QUANTUM_GATEWAY_PKGS,
127@@ -138,9 +144,10 @@
128
129 def get_packages():
130 '''Return a list of packages for install based on the configured plugin'''
131- packages = deepcopy(GATEWAY_PKGS[networking_name()][config('plugin')])
132+ plugin = remap_plugin(config('plugin'))
133+ packages = deepcopy(GATEWAY_PKGS[networking_name()][plugin])
134 if (get_os_codename_install_source(config('openstack-origin'))
135- >= 'icehouse' and config('plugin') == 'ovs'):
136+ >= 'icehouse' and plugin == 'ovs'):
137 # NOTE(jamespage) neutron-vpn-agent supercedes l3-agent for icehouse
138 packages.remove('neutron-l3-agent')
139 packages.append('neutron-vpn-agent')
140@@ -298,7 +305,9 @@
141
142 QUANTUM_NVP_CONFIG_FILES = {
143 QUANTUM_CONF: {
144- 'hook_contexts': [context.AMQPContext(ssl_dir=QUANTUM_CONF_DIR)],
145+ 'hook_contexts': [context.AMQPContext(ssl_dir=QUANTUM_CONF_DIR),
146+ QuantumGatewayContext(),
147+ SyslogContext()],
148 'services': ['quantum-dhcp-agent', 'quantum-metadata-agent']
149 },
150 }
151@@ -306,7 +315,9 @@
152
153 NEUTRON_NVP_CONFIG_FILES = {
154 NEUTRON_CONF: {
155- 'hook_contexts': [context.AMQPContext(ssl_dir=NEUTRON_CONF_DIR)],
156+ 'hook_contexts': [context.AMQPContext(ssl_dir=NEUTRON_CONF_DIR),
157+ QuantumGatewayContext(),
158+ SyslogContext()],
159 'services': ['neutron-dhcp-agent', 'neutron-metadata-agent']
160 },
161 }
162@@ -318,6 +329,7 @@
163 OVS: QUANTUM_OVS_CONFIG_FILES,
164 },
165 NEUTRON: {
166+ NSX: NEUTRON_NVP_CONFIG_FILES,
167 NVP: NEUTRON_NVP_CONFIG_FILES,
168 OVS: NEUTRON_OVS_CONFIG_FILES,
169 },
170@@ -330,7 +342,7 @@
171 configs = templating.OSConfigRenderer(templates_dir=TEMPLATES,
172 openstack_release=release)
173
174- plugin = config('plugin')
175+ plugin = remap_plugin(config('plugin'))
176 name = networking_name()
177 if plugin == 'ovs':
178 # NOTE: deal with switch to ML2 plugin for >= icehouse
179
180=== modified file 'templates/havana/dhcp_agent.ini'
181--- templates/havana/dhcp_agent.ini 2014-04-10 16:50:13 +0000
182+++ templates/havana/dhcp_agent.ini 2014-05-21 10:34:16 +0000
183@@ -11,7 +11,7 @@
184 {% if instance_mtu -%}
185 dnsmasq_config_file = /etc/neutron/dnsmasq.conf
186 {% endif -%}
187-{% if plugin == 'nvp' -%}
188+{% if plugin == 'nvp' or plugin == 'nsx' -%}
189 enable_metadata_network = True
190 enable_isolated_metadata = True
191 {% endif -%}
192
193=== modified file 'unit_tests/test_quantum_contexts.py'
194--- unit_tests/test_quantum_contexts.py 2014-04-10 16:50:13 +0000
195+++ unit_tests/test_quantum_contexts.py 2014-05-21 10:34:16 +0000
196@@ -290,10 +290,10 @@
197 _query.assert_called_with('myhost.example.com', 'A')
198
199
200-class TestNetworkingName(CharmTestCase):
201+class TestMisc(CharmTestCase):
202
203 def setUp(self):
204- super(TestNetworkingName,
205+ super(TestMisc,
206 self).setUp(quantum_contexts,
207 TO_PATCH)
208
209@@ -304,3 +304,29 @@
210 def test_ge_havana(self):
211 self.get_os_codename_install_source.return_value = 'havana'
212 self.assertEquals(quantum_contexts.networking_name(), 'neutron')
213+
214+ def test_remap_plugin(self):
215+ self.get_os_codename_install_source.return_value = 'havana'
216+ self.assertEquals(quantum_contexts.remap_plugin('nvp'), 'nvp')
217+ self.assertEquals(quantum_contexts.remap_plugin('nsx'), 'nvp')
218+
219+ def test_remap_plugin_icehouse(self):
220+ self.get_os_codename_install_source.return_value = 'icehouse'
221+ self.assertEquals(quantum_contexts.remap_plugin('nvp'), 'nsx')
222+ self.assertEquals(quantum_contexts.remap_plugin('nsx'), 'nsx')
223+
224+ def test_remap_plugin_noop(self):
225+ self.get_os_codename_install_source.return_value = 'icehouse'
226+ self.assertEquals(quantum_contexts.remap_plugin('ovs'), 'ovs')
227+
228+ def test_core_plugin(self):
229+ self.get_os_codename_install_source.return_value = 'havana'
230+ self.config.return_value = 'ovs'
231+ self.assertEquals(quantum_contexts.core_plugin(),
232+ quantum_contexts.NEUTRON_OVS_PLUGIN)
233+
234+ def test_core_plugin_ml2(self):
235+ self.get_os_codename_install_source.return_value = 'icehouse'
236+ self.config.return_value = 'ovs'
237+ self.assertEquals(quantum_contexts.core_plugin(),
238+ quantum_contexts.NEUTRON_ML2_PLUGIN)
239
240=== modified file 'unit_tests/test_quantum_utils.py'
241--- unit_tests/test_quantum_utils.py 2014-04-10 13:45:11 +0000
242+++ unit_tests/test_quantum_utils.py 2014-05-21 10:34:16 +0000
243@@ -41,7 +41,8 @@
244 'relations_of_type',
245 'service_stop',
246 'determine_dkms_package',
247- 'service_restart'
248+ 'service_restart',
249+ 'remap_plugin'
250 ]
251
252
253@@ -61,6 +62,9 @@
254 super(TestQuantumUtils, self).setUp(quantum_utils, TO_PATCH)
255 self.networking_name.return_value = 'neutron'
256 self.headers_package.return_value = 'linux-headers-2.6.18'
257+ def noop(value):
258+ return value
259+ self.remap_plugin.side_effect = noop
260
261 def tearDown(self):
262 # Reset cached cache
263@@ -71,6 +75,8 @@
264 self.assertTrue(quantum_utils.valid_plugin())
265 self.config.return_value = 'nvp'
266 self.assertTrue(quantum_utils.valid_plugin())
267+ self.config.return_value = 'nsx'
268+ self.assertTrue(quantum_utils.valid_plugin())
269
270 def test_invalid_plugin(self):
271 self.config.return_value = 'invalid'
272@@ -212,6 +218,20 @@
273 ['hook_contexts']
274 )
275
276+ def test_register_configs_nsx(self):
277+ self.config.return_value = 'nsx'
278+ configs = quantum_utils.register_configs()
279+ confs = [quantum_utils.NEUTRON_DHCP_AGENT_CONF,
280+ quantum_utils.NEUTRON_METADATA_AGENT_CONF,
281+ quantum_utils.NOVA_CONF,
282+ quantum_utils.NEUTRON_CONF]
283+ for conf in confs:
284+ configs.register.assert_any_call(
285+ conf,
286+ quantum_utils.CONFIG_FILES['neutron'][quantum_utils.NSX][conf]
287+ ['hook_contexts']
288+ )
289+
290 def test_stop_services_nvp(self):
291 self.config.return_value = 'nvp'
292 quantum_utils.stop_services()

Subscribers

People subscribed via source and target branches

to all changes: