Merge lp:~gnuoy/charms/trusty/neutron-openvswitch/next-l2-population into lp:~openstack-charmers-archive/charms/trusty/neutron-openvswitch/next

Proposed by Liam Young
Status: Merged
Merged at revision: 32
Proposed branch: lp:~gnuoy/charms/trusty/neutron-openvswitch/next-l2-population
Merge into: lp:~openstack-charmers-archive/charms/trusty/neutron-openvswitch/next
Diff against target: 107 lines (+29/-15)
3 files modified
hooks/neutron_ovs_context.py (+22/-12)
templates/icehouse/ml2_conf.ini (+2/-1)
unit_tests/test_neutron_ovs_context.py (+5/-2)
To merge this branch: bzr merge lp:~gnuoy/charms/trusty/neutron-openvswitch/next-l2-population
Reviewer Review Type Date Requested Status
James Page Approve
Review via email: mp+236477@code.launchpad.net
To post a comment you must log in.
Revision history for this message
James Page (james-page) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/neutron_ovs_context.py'
2--- hooks/neutron_ovs_context.py 2014-07-24 10:30:22 +0000
3+++ hooks/neutron_ovs_context.py 2014-09-30 09:51:31 +0000
4@@ -18,19 +18,26 @@
5 DATA_BRIDGE = 'br-data'
6
7
8-def _neutron_security_groups():
9- '''
10- Inspects current neutron-plugin relation and determine if neutron-api has
11- instructed us to use neutron security groups.
12- '''
13+def _neutron_api_settings():
14+ '''
15+ Inspects current neutron-plugin relation
16+ '''
17+ neutron_settings = {
18+ 'neutron_security_groups': False,
19+ 'l2_population': True,
20+
21+ }
22 for rid in relation_ids('neutron-plugin-api'):
23 for unit in related_units(rid):
24- sec_group = relation_get('neutron-security-groups',
25- rid=rid,
26- unit=unit)
27- if sec_group is not None:
28- return sec_group
29- return False
30+ rdata = relation_get(rid=rid, unit=unit)
31+ if 'l2-population' not in rdata:
32+ continue
33+ neutron_settings = {
34+ 'l2_population': rdata['l2-population'],
35+ 'neutron_security_groups': rdata['neutron-security-groups']
36+ }
37+ return neutron_settings
38+ return neutron_settings
39
40
41 class OVSPluginContext(context.NeutronContext):
42@@ -46,7 +53,8 @@
43
44 @property
45 def neutron_security_groups(self):
46- return _neutron_security_groups()
47+ neutron_api_settings = _neutron_api_settings()
48+ return neutron_api_settings['neutron_security_groups']
49
50 def get_data_port(self):
51 data_ports = config('data-port')
52@@ -88,7 +96,9 @@
53 ovs_ctxt['local_ip'] = \
54 get_address_in_network(config('os-data-network'),
55 get_host_ip(unit_get('private-address')))
56+ neutron_api_settings = _neutron_api_settings()
57 ovs_ctxt['neutron_security_groups'] = self.neutron_security_groups
58+ ovs_ctxt['l2_population'] = neutron_api_settings['l2_population']
59 # TODO: We need to sort out the syslog and debug/verbose options as a
60 # general context helper
61 ovs_ctxt['use_syslog'] = conf['use-syslog']
62
63=== modified file 'templates/icehouse/ml2_conf.ini'
64--- templates/icehouse/ml2_conf.ini 2014-07-14 11:47:38 +0000
65+++ templates/icehouse/ml2_conf.ini 2014-09-30 09:51:31 +0000
66@@ -7,7 +7,7 @@
67 [ml2]
68 type_drivers = gre,vxlan,vlan,flat
69 tenant_network_types = gre,vxlan,vlan,flat
70-mechanism_drivers = openvswitch,hyperv
71+mechanism_drivers = openvswitch,hyperv,l2population
72
73 [ml2_type_gre]
74 tunnel_id_ranges = 1:1000
75@@ -28,6 +28,7 @@
76
77 [agent]
78 tunnel_types = gre
79+l2_population = {{ l2_population }}
80
81 [securitygroup]
82 {% if neutron_security_groups == 'True' -%}
83
84=== modified file 'unit_tests/test_neutron_ovs_context.py'
85--- unit_tests/test_neutron_ovs_context.py 2014-07-21 13:03:08 +0000
86+++ unit_tests/test_neutron_ovs_context.py 2014-09-30 09:51:31 +0000
87@@ -88,7 +88,9 @@
88 _is_clus.return_value = False
89 self.related_units.return_value = ['unit1']
90 self.relation_ids.return_value = ['rid2']
91- self.test_relation.set({'neutron-security-groups': 'yes'})
92+ self.test_relation.set({'neutron-security-groups': 'yes',
93+ 'l2-population': True,
94+ })
95 self.get_host_ip.return_value = '127.0.0.15'
96 self.service_running.return_value = False
97 napi_ctxt = context.OVSPluginContext()
98@@ -103,7 +105,8 @@
99 'debug': True,
100 'core_plugin': 'neutron.randomdriver',
101 'neutron_plugin': 'ovs',
102- 'neutron_url': 'https://127.0.0.13:9696'
103+ 'neutron_url': 'https://127.0.0.13:9696',
104+ 'l2_population': True,
105 }
106 self.assertEquals(expect, napi_ctxt())
107 self.service_start.assertCalled()

Subscribers

People subscribed via source and target branches