Merge lp:~celebdor/charms/trusty/neutron-api/midonet into lp:~openstack-charmers-archive/charms/trusty/neutron-api/next
- Trusty Tahr (14.04)
- midonet
- Merge into next
Status: | Work in progress |
---|---|
Proposed branch: | lp:~celebdor/charms/trusty/neutron-api/midonet |
Merge into: | lp:~openstack-charmers-archive/charms/trusty/neutron-api/next |
Diff against target: |
609 lines (+310/-23) 18 files modified
config.yaml (+27/-0) files/midokura.key (+19/-0) files/midonet.key (+24/-0) hooks/charmhelpers/contrib/openstack/amulet/utils.py (+1/-1) hooks/charmhelpers/contrib/openstack/context.py (+40/-13) hooks/charmhelpers/contrib/openstack/neutron.py (+17/-3) hooks/charmhelpers/contrib/openstack/templates/ceph.conf (+6/-0) hooks/charmhelpers/core/hookenv.py (+0/-1) hooks/charmhelpers/core/kernel.py (+68/-0) hooks/neutron_api_context.py (+24/-0) hooks/neutron_api_hooks.py (+16/-2) hooks/neutron_api_utils.py (+40/-0) metadata.yaml (+5/-0) templates/juno/midonet.ini (+11/-0) templates/juno/neutron.conf (+3/-1) templates/kilo/neutron.conf (+5/-1) tests/charmhelpers/contrib/openstack/amulet/utils.py (+1/-1) unit_tests/test_neutron_api_context.py (+3/-0) |
To merge this branch: | bzr merge lp:~celebdor/charms/trusty/neutron-api/midonet |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Page | Needs Fixing | ||
Review via email: mp+273772@code.launchpad.net |
Commit message
Description of the change
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #10695 neutron-api-next for celebdor mp273772
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #7207 neutron-api-next for celebdor mp273772
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
- 152. By Antoni Segura Puimedon <email address hidden>
-
midonet: Fix faulty cherry-pick references
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #11538 neutron-api-next for celebdor mp273772
LINT FAIL: lint-test failed
LINT FAIL: charm-proof failed
LINT Results (max last 2 lines):
make: *** [lint] Error 100
ERROR:root:Make target returned non-zero.
Full lint test output: http://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #10730 neutron-api-next for celebdor mp273772
UNIT OK: passed
- 153. By Antoni Segura Puimedon <email address hidden>
-
midonet: fix lint
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #11540 neutron-api-next for celebdor mp273772
LINT OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #10732 neutron-api-next for celebdor mp273772
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #7241 neutron-api-next for celebdor mp273772
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
James Page (james-page) wrote : | # |
Some comments, but looking OK
Antoni Segura Puimedon (celebdor) : | # |
Antoni Segura Puimedon (celebdor) : | # |
- 154. By Antoni Segura Puimedon <email address hidden>
-
midonet: fix wrong relation reference
MidonetContext was developed in
charmhelpers/contrib/ openstack/ context. py
It is better to have it inside of neutron_api_context since
it is only used by Neutron (of all OSt charms). - 155. By Antoni Segura Puimedon <email address hidden>
-
midonet: move gpg keys into files
- 156. By Antoni Segura Puimedon <email address hidden>
-
midonet: fix the MidonetContext backport
- 157. By Antoni Segura Puimedon <email address hidden>
-
midonet: use charm_dir to get to the gpg files
- 158. By Antoni Segura Puimedon <email address hidden>
-
midonet: fix service driver regression for other plugins
Unmerged revisions
- 158. By Antoni Segura Puimedon <email address hidden>
-
midonet: fix service driver regression for other plugins
- 157. By Antoni Segura Puimedon <email address hidden>
-
midonet: use charm_dir to get to the gpg files
- 156. By Antoni Segura Puimedon <email address hidden>
-
midonet: fix the MidonetContext backport
- 155. By Antoni Segura Puimedon <email address hidden>
-
midonet: move gpg keys into files
- 154. By Antoni Segura Puimedon <email address hidden>
-
midonet: fix wrong relation reference
MidonetContext was developed in
charmhelpers/contrib/ openstack/ context. py
It is better to have it inside of neutron_api_context since
it is only used by Neutron (of all OSt charms). - 153. By Antoni Segura Puimedon <email address hidden>
-
midonet: fix lint
- 152. By Antoni Segura Puimedon <email address hidden>
-
midonet: Fix faulty cherry-pick references
- 151. By Antoni Segura Puimedon <email address hidden>
-
Add MidoNet support for >= juno
- 150. By Antoni Segura Puimedon <email address hidden>
-
CH sync for MidoNet support
Preview Diff
1 | === modified file 'config.yaml' |
2 | --- config.yaml 2015-09-25 16:09:26 +0000 |
3 | +++ config.yaml 2015-10-09 14:49:21 +0000 |
4 | @@ -100,6 +100,7 @@ |
5 | ovs - OpenvSwitch Plugin |
6 | nsx - VMWare NSX |
7 | Calico - Project Calico Networking |
8 | + midonet - MidoNet |
9 | . |
10 | overlay-network-type: |
11 | default: gre |
12 | @@ -408,3 +409,29 @@ |
13 | wait for you to execute the openstack-upgrade action for this charm on |
14 | each unit. If False it will revert to existing behavior of upgrading |
15 | all units on config change. |
16 | + # MidoNet plugin configuration |
17 | + midonet-release: |
18 | + default: latest |
19 | + type: string |
20 | + description: | |
21 | + Repository from which to install. May be one of the following: |
22 | + latest (default) or one of the following: |
23 | + 'icehouse/mem-1.8', 'juno/mem-1.8', 'juno/mem-1.9', 'kilo/mem-1.9', |
24 | + 'juno/midonet-2015.06', 'kilo/midonet-2015.06' |
25 | + |
26 | + Note that updating this setting to a source that is known to |
27 | + provide a later version of OpenStack will trigger a software |
28 | + upgrade. |
29 | + mem-username: |
30 | + type: string |
31 | + default: |
32 | + description: | |
33 | + The Midokura Enterprise MidoNet username credentials to access the |
34 | + repository. |
35 | + mem-password: |
36 | + type: string |
37 | + default: |
38 | + description: | |
39 | + The Midokura Enterprise MidoNet password credentials to access the |
40 | + repository. |
41 | + # End of MidoNet plugin configuration |
42 | |
43 | === added file 'files/midokura.key' |
44 | --- files/midokura.key 1970-01-01 00:00:00 +0000 |
45 | +++ files/midokura.key 2015-10-09 14:49:21 +0000 |
46 | @@ -0,0 +1,19 @@ |
47 | +-----BEGIN PGP PUBLIC KEY BLOCK----- |
48 | +Version: SKS 1.1.5 |
49 | +Comment: Hostname: keyserver.ubuntu.com |
50 | + |
51 | +mI0ETb6aOgEEAMVw8Vnwk+zpDtsc0gSW10JEe48zKr2vpl9tQgWAFOPgOA1NglYMw/xT6Rns |
52 | +7CrYxPR0cb3DeMFtFdMkfWXO0R6x4yHrozMDY/DpvwgYQclIIbcYYe0p83nlBp793D2dSq60 |
53 | +HWuXJu3oi0wQQuR0/jTmOnjxzCzu5jKdJeXihl95ABEBAAG0Jk1pZG9rdXJhIChNaWRva3Vy |
54 | +YSkgPGluZm9AbWlkb2t1cmEuanA+iLgEEwECACIFAk2+mjoCGwMGCwkIBwMCBhUIAgkKCwQW |
55 | +AgMBAh4BAheAAAoJEGezjToFQxTNAp0D/2c+PLnRFzEXCztXT+05xoO1mPzpm3x2p5ecVPGH |
56 | +R8IxhozlN9DDGDdnvNfMOhi6nv/G2l86+9Fj8Dz01ne0RZzZHSS1DF/zb6dMYrPJqiT1DXKH |
57 | +0Y73OL/+M7rsutEq0B/DKhjdBfFPutk3gerEUZPNfIhScE3tnwCnVGJKPQbFuI0ETb6aOgEE |
58 | +ANLJK3gmXrsp1VKnt663RoxZgoFQgQ6wHaZZWhULTteafjoThX9tj7FidR2+7qJLwpa57M9d |
59 | +rib4OlbW+rE4PW199/Uqfy86gLv76Q2GZMpzaYB1ZZow0Ny1RTCwh7apkhR/8fCUpq37aODQ |
60 | +4YwBpZC54iXVKfcntpdJFoObIqXtABEBAAGInwQYAQIACQUCTb6aOgIbDAAKCRBns406BUMU |
61 | +zfzOBACKx4jChKTAl6HfldOxVN7o8DQpd5rgkHIEj062ym4Zq5t2v3oaz0H0P2WV66MAhOuj |
62 | +gX0V1duZi8fKHdIsdk0nvEa/mV0QS6pEAeZh+dbLkKyu1J4MSi5l+L+te5XjYBGpoRa3ZGrI |
63 | +R3CkA0oQDCOh312SrcH6Tn9RBPChVSigzg== |
64 | +=zF5K |
65 | +-----END PGP PUBLIC KEY BLOCK----- |
66 | |
67 | === added file 'files/midonet.key' |
68 | --- files/midonet.key 1970-01-01 00:00:00 +0000 |
69 | +++ files/midonet.key 2015-10-09 14:49:21 +0000 |
70 | @@ -0,0 +1,24 @@ |
71 | +-----BEGIN PGP PUBLIC KEY BLOCK----- |
72 | +Version: SKS 1.1.5 |
73 | +Comment: Hostname: keyserver.ubuntu.com |
74 | + |
75 | +mQGiBFRF760RBADwIz8rK0K1qiXbq0/cda42oKZW+jvcqUIDsNeKYSWI5YRfS4NX+jRJM/rL |
76 | +PzQD+JZtLeFHeLK0qxpr5b2acxleOgNfw3hzxz4DNQsVbkts3n1s7YT80DwNdYPBbFCAOOkJ |
77 | +jH7CL2PN4fTs5eP/0QpMOZT+s5DTqozPDgTYWhhVrwCgoc5H2zYVW86Ok3c0fOru9VZPJxsE |
78 | +AIexw3sBv9FZyvVr6rehiVlzOtwfHwSEQZQ511so46H5GdLqQFwThKmWVvxyDAGshtpjLJbs |
79 | +KHilEJVkfzhs/xyCjwAPl8VbIYgUy/FlhKtFWWxkQLlUwuC5iOPLdzhoL1PEzZuCYmMkSr0E |
80 | +XASN83nbzIIqdQgvEZrAUGUzTf68A/9eSiry88vEIIGL7hT2rw/NockwCGsc2xrjqrfs9PpU |
81 | +rg7ksTPua1UQUkMeWoKEoYpGppGd5XXEvo6287i8eAB4B9qr4AGbz8NKmVI2lC9V641Ecu3/ |
82 | +kmhaGQRBmCZgcW3B987rTyY5lsLc66+tNai6L72y1fj5nBtY2MVYg6ixZrRNTWlkb2t1cmEg |
83 | +UlBNICYgREVCIFJlcG9zaXRvcnkgQXV0b21hdGljIFNpZ25pbmcgS2V5ICgyMDE0KSA8b3Bz |
84 | +QG1pZG9rdXJhLmNvbT6IYgQTEQIAIgUCVEXvrQIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgEC |
85 | +F4AACgkQ/ONA0lDxj8+EZgCdEqXQrZ8PiemTgQK7044Deed5OpsAnjL8Cw4GnGJZHmW24pKQ |
86 | +IkzTvb1SuQENBFRF760QBADJD9aLzLYAehNITLlrNao+bZsSAAeKRYWjtyf6Z620/WiQw6a+ |
87 | +01/ZwrthvXNUcnIVIKKokPVpXR29AUV0T7npDMTkQCXfw24X+9NedBCquJpHnBS/YySHP+EJ |
88 | +vNeLc0xdwnOcGehe7IeaDN0eEWx+HVhEfC/lXa/Pebs4OpIo/wADBwQAwyCTQ7Vod3jO7JFP |
89 | +6R6mS5gX3Sx6s3ocE4laDFBmh9d8GPWpdzHwzPzrVaIw/xSaxP2zXeWFcDoY3zT7PH3dm+xj |
90 | +cEG23iTqvmMAr7EXirKu9pL/DKuBPncNMTS6JoltGGVzZLoJF2OJZX81c+U1mGyLpWg/hK3K |
91 | +t9VpzNjFGc2ISQQYEQIACQUCVEXvrQIbDAAKCRD840DSUPGPz0PiAJ9QXGyMCTymuuCdYyEX |
92 | +3D94y0Z8FgCaAwYNRahgGw/HN04xkqfrN7bXajE= |
93 | +=hLRg |
94 | +-----END PGP PUBLIC KEY BLOCK----- |
95 | |
96 | === modified file 'hooks/charmhelpers/contrib/openstack/amulet/utils.py' |
97 | --- hooks/charmhelpers/contrib/openstack/amulet/utils.py 2015-09-25 14:35:35 +0000 |
98 | +++ hooks/charmhelpers/contrib/openstack/amulet/utils.py 2015-10-09 14:49:21 +0000 |
99 | @@ -752,7 +752,7 @@ |
100 | self.log.debug('SSL is enabled @{}:{} ' |
101 | '({})'.format(host, port, unit_name)) |
102 | return True |
103 | - elif not port and not conf_ssl: |
104 | + elif not conf_ssl: |
105 | self.log.debug('SSL not enabled @{}:{} ' |
106 | '({})'.format(host, port, unit_name)) |
107 | return False |
108 | |
109 | === modified file 'hooks/charmhelpers/contrib/openstack/context.py' |
110 | --- hooks/charmhelpers/contrib/openstack/context.py 2015-09-28 19:06:04 +0000 |
111 | +++ hooks/charmhelpers/contrib/openstack/context.py 2015-10-09 14:49:21 +0000 |
112 | @@ -14,6 +14,7 @@ |
113 | # You should have received a copy of the GNU Lesser General Public License |
114 | # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. |
115 | |
116 | +import glob |
117 | import json |
118 | import os |
119 | import re |
120 | @@ -951,6 +952,19 @@ |
121 | 'config': config} |
122 | return ovs_ctxt |
123 | |
124 | + def midonet_ctxt(self): |
125 | + driver = neutron_plugin_attribute(self.plugin, 'driver', |
126 | + self.network_manager) |
127 | + midonet_config = neutron_plugin_attribute(self.plugin, 'config', |
128 | + self.network_manager) |
129 | + mido_ctxt = {'core_plugin': driver, |
130 | + 'neutron_plugin': 'midonet', |
131 | + 'neutron_security_groups': self.neutron_security_groups, |
132 | + 'local_ip': unit_private_ip(), |
133 | + 'config': midonet_config} |
134 | + |
135 | + return mido_ctxt |
136 | + |
137 | def __call__(self): |
138 | if self.network_manager not in ['quantum', 'neutron']: |
139 | return {} |
140 | @@ -972,6 +986,8 @@ |
141 | ctxt.update(self.nuage_ctxt()) |
142 | elif self.plugin == 'plumgrid': |
143 | ctxt.update(self.pg_ctxt()) |
144 | + elif self.plugin == 'midonet': |
145 | + ctxt.update(self.midonet_ctxt()) |
146 | |
147 | alchemy_flags = config('neutron-alchemy-flags') |
148 | if alchemy_flags: |
149 | @@ -1104,7 +1120,7 @@ |
150 | |
151 | ctxt = { |
152 | ... other context ... |
153 | - 'subordinate_config': { |
154 | + 'subordinate_configuration': { |
155 | 'DEFAULT': { |
156 | 'key1': 'value1', |
157 | }, |
158 | @@ -1145,22 +1161,23 @@ |
159 | try: |
160 | sub_config = json.loads(sub_config) |
161 | except: |
162 | - log('Could not parse JSON from subordinate_config ' |
163 | - 'setting from %s' % rid, level=ERROR) |
164 | + log('Could not parse JSON from ' |
165 | + 'subordinate_configuration setting from %s' |
166 | + % rid, level=ERROR) |
167 | continue |
168 | |
169 | for service in self.services: |
170 | if service not in sub_config: |
171 | - log('Found subordinate_config on %s but it contained' |
172 | - 'nothing for %s service' % (rid, service), |
173 | - level=INFO) |
174 | + log('Found subordinate_configuration on %s but it ' |
175 | + 'contained nothing for %s service' |
176 | + % (rid, service), level=INFO) |
177 | continue |
178 | |
179 | sub_config = sub_config[service] |
180 | if self.config_file not in sub_config: |
181 | - log('Found subordinate_config on %s but it contained' |
182 | - 'nothing for %s' % (rid, self.config_file), |
183 | - level=INFO) |
184 | + log('Found subordinate_configuration on %s but it ' |
185 | + 'contained nothing for %s' |
186 | + % (rid, self.config_file), level=INFO) |
187 | continue |
188 | |
189 | sub_config = sub_config[self.config_file] |
190 | @@ -1363,7 +1380,7 @@ |
191 | normalized.update({port: port for port in resolved |
192 | if port in ports}) |
193 | if resolved: |
194 | - return {bridge: normalized[port] for port, bridge in |
195 | + return {normalized[port]: bridge for port, bridge in |
196 | six.iteritems(portmap) if port in normalized.keys()} |
197 | |
198 | return None |
199 | @@ -1374,12 +1391,22 @@ |
200 | def __call__(self): |
201 | ctxt = {} |
202 | mappings = super(PhyNICMTUContext, self).__call__() |
203 | - if mappings and mappings.values(): |
204 | - ports = mappings.values() |
205 | + if mappings and mappings.keys(): |
206 | + ports = sorted(mappings.keys()) |
207 | napi_settings = NeutronAPIContext()() |
208 | mtu = napi_settings.get('network_device_mtu') |
209 | + all_ports = set() |
210 | + # If any of ports is a vlan device, its underlying device must have |
211 | + # mtu applied first. |
212 | + for port in ports: |
213 | + for lport in glob.glob("/sys/class/net/%s/lower_*" % port): |
214 | + lport = os.path.basename(lport) |
215 | + all_ports.add(lport.split('_')[1]) |
216 | + |
217 | + all_ports = list(all_ports) |
218 | + all_ports.extend(ports) |
219 | if mtu: |
220 | - ctxt["devs"] = '\\n'.join(ports) |
221 | + ctxt["devs"] = '\\n'.join(all_ports) |
222 | ctxt['mtu'] = mtu |
223 | |
224 | return ctxt |
225 | |
226 | === modified file 'hooks/charmhelpers/contrib/openstack/neutron.py' |
227 | --- hooks/charmhelpers/contrib/openstack/neutron.py 2015-09-04 11:03:14 +0000 |
228 | +++ hooks/charmhelpers/contrib/openstack/neutron.py 2015-10-09 14:49:21 +0000 |
229 | @@ -209,6 +209,20 @@ |
230 | 'server_packages': ['neutron-server', |
231 | 'neutron-plugin-plumgrid'], |
232 | 'server_services': ['neutron-server'] |
233 | + }, |
234 | + 'midonet': { |
235 | + 'config': '/etc/neutron/plugins/midonet/midonet.ini', |
236 | + 'driver': 'midonet.neutron.plugin.MidonetPluginV2', |
237 | + 'contexts': [ |
238 | + context.SharedDBContext(user=config('neutron-database-user'), |
239 | + database=config('neutron-database'), |
240 | + relation_prefix='neutron', |
241 | + ssl_dir=NEUTRON_CONF_DIR)], |
242 | + 'services': [], |
243 | + 'packages': [[headers_package()] + determine_dkms_package()], |
244 | + 'server_packages': ['neutron-server', |
245 | + 'python-neutron-plugin-midonet'], |
246 | + 'server_services': ['neutron-server'] |
247 | } |
248 | } |
249 | if release >= 'icehouse': |
250 | @@ -310,10 +324,10 @@ |
251 | def parse_data_port_mappings(mappings, default_bridge='br-data'): |
252 | """Parse data port mappings. |
253 | |
254 | - Mappings must be a space-delimited list of port:bridge mappings. |
255 | + Mappings must be a space-delimited list of bridge:port. |
256 | |
257 | - Returns dict of the form {port:bridge} where port may be an mac address or |
258 | - interface name. |
259 | + Returns dict of the form {port:bridge} where ports may be mac addresses or |
260 | + interface names. |
261 | """ |
262 | |
263 | # NOTE(dosaboy): we use rvalue for key to allow multiple values to be |
264 | |
265 | === modified file 'hooks/charmhelpers/contrib/openstack/templates/ceph.conf' |
266 | --- hooks/charmhelpers/contrib/openstack/templates/ceph.conf 2015-07-16 20:17:53 +0000 |
267 | +++ hooks/charmhelpers/contrib/openstack/templates/ceph.conf 2015-10-09 14:49:21 +0000 |
268 | @@ -13,3 +13,9 @@ |
269 | err to syslog = {{ use_syslog }} |
270 | clog to syslog = {{ use_syslog }} |
271 | |
272 | +[client] |
273 | +{% if rbd_client_cache_settings -%} |
274 | +{% for key, value in rbd_client_cache_settings.iteritems() -%} |
275 | +{{ key }} = {{ value }} |
276 | +{% endfor -%} |
277 | +{%- endif %} |
278 | \ No newline at end of file |
279 | |
280 | === modified file 'hooks/charmhelpers/core/hookenv.py' |
281 | --- hooks/charmhelpers/core/hookenv.py 2015-09-28 19:06:04 +0000 |
282 | +++ hooks/charmhelpers/core/hookenv.py 2015-10-09 14:49:21 +0000 |
283 | @@ -795,7 +795,6 @@ |
284 | raise |
285 | log_message = 'status-set failed: {} {}'.format(workload_state, |
286 | message) |
287 | - # XXX Fix this |
288 | log(log_message, level='INFO') |
289 | |
290 | |
291 | |
292 | === added file 'hooks/charmhelpers/core/kernel.py' |
293 | --- hooks/charmhelpers/core/kernel.py 1970-01-01 00:00:00 +0000 |
294 | +++ hooks/charmhelpers/core/kernel.py 2015-10-09 14:49:21 +0000 |
295 | @@ -0,0 +1,68 @@ |
296 | +#!/usr/bin/env python |
297 | +# -*- coding: utf-8 -*- |
298 | + |
299 | +# Copyright 2014-2015 Canonical Limited. |
300 | +# |
301 | +# This file is part of charm-helpers. |
302 | +# |
303 | +# charm-helpers is free software: you can redistribute it and/or modify |
304 | +# it under the terms of the GNU Lesser General Public License version 3 as |
305 | +# published by the Free Software Foundation. |
306 | +# |
307 | +# charm-helpers is distributed in the hope that it will be useful, |
308 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
309 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
310 | +# GNU Lesser General Public License for more details. |
311 | +# |
312 | +# You should have received a copy of the GNU Lesser General Public License |
313 | +# along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. |
314 | + |
315 | +__author__ = "Jorge Niedbalski <jorge.niedbalski@canonical.com>" |
316 | + |
317 | +from charmhelpers.core.hookenv import ( |
318 | + log, |
319 | + INFO |
320 | +) |
321 | + |
322 | +from subprocess import check_call, check_output |
323 | +import re |
324 | + |
325 | + |
326 | +def modprobe(module, persist=True): |
327 | + """Load a kernel module and configure for auto-load on reboot.""" |
328 | + cmd = ['modprobe', module] |
329 | + |
330 | + log('Loading kernel module %s' % module, level=INFO) |
331 | + |
332 | + check_call(cmd) |
333 | + if persist: |
334 | + with open('/etc/modules', 'r+') as modules: |
335 | + if module not in modules.read(): |
336 | + modules.write(module) |
337 | + |
338 | + |
339 | +def rmmod(module, force=False): |
340 | + """Remove a module from the linux kernel""" |
341 | + cmd = ['rmmod'] |
342 | + if force: |
343 | + cmd.append('-f') |
344 | + cmd.append(module) |
345 | + log('Removing kernel module %s' % module, level=INFO) |
346 | + return check_call(cmd) |
347 | + |
348 | + |
349 | +def lsmod(): |
350 | + """Shows what kernel modules are currently loaded""" |
351 | + return check_output(['lsmod'], |
352 | + universal_newlines=True) |
353 | + |
354 | + |
355 | +def is_module_loaded(module): |
356 | + """Checks if a kernel module is already loaded""" |
357 | + matches = re.findall('^%s[ ]+' % module, lsmod(), re.M) |
358 | + return len(matches) > 0 |
359 | + |
360 | + |
361 | +def update_initramfs(version='all'): |
362 | + """Updates an initramfs image""" |
363 | + return check_call(["update-initramfs", "-k", version, "-u"]) |
364 | |
365 | === added symlink 'hooks/midonet-relation-broken' |
366 | === target is u'neutron_api_hooks.py' |
367 | === added symlink 'hooks/midonet-relation-changed' |
368 | === target is u'neutron_api_hooks.py' |
369 | === added symlink 'hooks/midonet-relation-joined' |
370 | === target is u'neutron_api_hooks.py' |
371 | === modified file 'hooks/neutron_api_context.py' |
372 | --- hooks/neutron_api_context.py 2015-10-07 22:11:33 +0000 |
373 | +++ hooks/neutron_api_context.py 2015-10-09 14:49:21 +0000 |
374 | @@ -166,6 +166,12 @@ |
375 | ctxt['pg_username'] = config('plumgrid-username') |
376 | ctxt['pg_password'] = config('plumgrid-password') |
377 | ctxt['virtual_ip'] = config('plumgrid-virtual-ip') |
378 | + elif config('neutron-plugin') == 'midonet': |
379 | + ctxt.update(MidonetContext()()) |
380 | + identity_context = IdentityServiceContext(service='neutron', |
381 | + service_user='neutron')() |
382 | + if identity_context is not None: |
383 | + ctxt.update(identity_context) |
384 | ctxt['l2_population'] = self.neutron_l2_population |
385 | ctxt['enable_dvr'] = self.neutron_dvr |
386 | ctxt['l3_ha'] = self.neutron_l3ha |
387 | @@ -324,3 +330,21 @@ |
388 | if neutron_server_plugin_conf: |
389 | return {'config': neutron_server_plugin_conf} |
390 | return {'config': '/etc/neutron/plugins/ml2/ml2_conf.ini'} |
391 | + |
392 | + |
393 | +class MidonetContext(context.OSContextGenerator): |
394 | + def __init__(self, rel_name='midonet'): |
395 | + self.rel_name = rel_name |
396 | + self.interfaces = [rel_name] |
397 | + |
398 | + def __call__(self): |
399 | + for rid in relation_ids(self.rel_name): |
400 | + for unit in related_units(rid): |
401 | + rdata = relation_get(rid=rid, unit=unit) |
402 | + ctxt = { |
403 | + 'midonet_api_ip': rdata.get('host'), |
404 | + 'midonet_api_port': rdata.get('port'), |
405 | + } |
406 | + if self.context_complete(ctxt): |
407 | + return ctxt |
408 | + return {} |
409 | |
410 | === modified file 'hooks/neutron_api_hooks.py' |
411 | --- hooks/neutron_api_hooks.py 2015-10-07 20:46:09 +0000 |
412 | +++ hooks/neutron_api_hooks.py 2015-10-09 14:49:21 +0000 |
413 | @@ -23,6 +23,7 @@ |
414 | ) |
415 | |
416 | from charmhelpers.core.host import ( |
417 | + mkdir, |
418 | restart_on_change, |
419 | service_reload, |
420 | service_restart, |
421 | @@ -151,9 +152,11 @@ |
422 | def install(): |
423 | status_set('maintenance', 'Executing pre-install') |
424 | execd_preinstall() |
425 | - configure_installation_source(config('openstack-origin')) |
426 | + openstack_origin = config('openstack-origin') |
427 | + configure_installation_source(openstack_origin) |
428 | + neutron_plugin = config('neutron-plugin') |
429 | additional_install_locations( |
430 | - config('neutron-plugin'), config('openstack-origin') |
431 | + neutron_plugin, config('openstack-origin') |
432 | ) |
433 | |
434 | status_set('maintenance', 'Installing apt packages') |
435 | @@ -165,6 +168,9 @@ |
436 | git_install(config('openstack-origin-git')) |
437 | |
438 | [open_port(port) for port in determine_ports()] |
439 | + if neutron_plugin == 'midonet': |
440 | + mkdir("/etc/neutron/plugins/midonet", owner='neutron', group='neutron', |
441 | + perms=0o755, force=False) |
442 | |
443 | |
444 | @hooks.hook('upgrade-charm') |
445 | @@ -538,6 +544,14 @@ |
446 | force_etcd_restart() |
447 | |
448 | |
449 | +@hooks.hook('midonet-relation-joined') |
450 | +@hooks.hook('midonet-relation-changed') |
451 | +@hooks.hook('midonet-relation-departed') |
452 | +@restart_on_change(restart_map()) |
453 | +def midonet_changed(): |
454 | + CONFIGS.write_all() |
455 | + |
456 | + |
457 | def main(): |
458 | try: |
459 | hooks.execute(sys.argv) |
460 | |
461 | === modified file 'hooks/neutron_api_utils.py' |
462 | --- hooks/neutron_api_utils.py 2015-10-09 01:57:04 +0000 |
463 | +++ hooks/neutron_api_utils.py 2015-10-09 14:49:21 +0000 |
464 | @@ -28,6 +28,7 @@ |
465 | ) |
466 | |
467 | from charmhelpers.core.hookenv import ( |
468 | + charm_dir, |
469 | config, |
470 | log, |
471 | relation_ids, |
472 | @@ -209,6 +210,45 @@ |
473 | |
474 | apt_update() |
475 | apt_upgrade() |
476 | + elif plugin == 'midonet': |
477 | + midonet_release = config('midonet-release') |
478 | + release_num = midonet_release.split('-')[1] |
479 | + |
480 | + if midonet_release.split('/')[1].startswith('mem'): |
481 | + with open(os.path.join(charm_dir(), |
482 | + 'files/midokura.key')) as midokura_gpg_key: |
483 | + priv_gpg_key = midokura_gpg_key.read() |
484 | + mem_username = config('mem-username') |
485 | + mem_password = config('mem-password') |
486 | + if 'kilo' in source: |
487 | + add_source( |
488 | + 'deb http://%s:%s@apt.midokura.com/openstack/kilo/stable ' |
489 | + 'trusty main' % (mem_username, mem_password), |
490 | + key=priv_gpg_key) |
491 | + elif 'juno' in source: |
492 | + add_source( |
493 | + 'deb http://%s:%s@apt.midokura.com/openstack/juno/stable ' |
494 | + 'trusty main' % (mem_username, mem_password), |
495 | + key=priv_gpg_key) |
496 | + |
497 | + add_source( |
498 | + 'http://%s:%s@apt.midokura.com/midonet/v%s/stable main' % ( |
499 | + mem_username, mem_password, release_num), key=priv_gpg_key) |
500 | + else: |
501 | + with open(os.path.join(charm_dir(), |
502 | + 'files/midonet.key')) as midonet_gpg_key: |
503 | + pub_gpg_key = midonet_gpg_key.read() |
504 | + if 'kilo' in source: |
505 | + add_source( |
506 | + 'deb http://repo.midonet.org/openstack-kilo stable main', |
507 | + key=pub_gpg_key) |
508 | + elif 'juno' in source: |
509 | + add_source( |
510 | + 'deb http://repo.midonet.org/openstack-juno stable main', |
511 | + key=pub_gpg_key) |
512 | + |
513 | + add_source('deb http://repo.midonet.org/midonet/v%s stable main' % |
514 | + release_num, key=pub_gpg_key) |
515 | |
516 | |
517 | def force_etcd_restart(): |
518 | |
519 | === modified file 'metadata.yaml' |
520 | --- metadata.yaml 2015-08-21 07:33:43 +0000 |
521 | +++ metadata.yaml 2015-10-09 14:49:21 +0000 |
522 | @@ -42,6 +42,11 @@ |
523 | scope: container |
524 | etcd-proxy: |
525 | interface: etcd-proxy |
526 | + midonet: |
527 | + interface: midonet |
528 | + midonet-host: |
529 | + interface: midonet-host |
530 | + scope: container |
531 | peers: |
532 | cluster: |
533 | interface: neutron-api-ha |
534 | |
535 | === added file 'templates/juno/midonet.ini' |
536 | --- templates/juno/midonet.ini 1970-01-01 00:00:00 +0000 |
537 | +++ templates/juno/midonet.ini 2015-10-09 14:49:21 +0000 |
538 | @@ -0,0 +1,11 @@ |
539 | +############################################################################### |
540 | +# [ WARNING ] |
541 | +# Configuration file maintained by Juju. Local changes may be overwritten. |
542 | +############################################################################### |
543 | +[MIDONET] |
544 | +# MidoNet API URL |
545 | +midonet_uri = http://{{ midonet_api_ip }}:{{ midonet_api_port }}/midonet-api |
546 | +# credentials |
547 | +username = {{ admin_user }} |
548 | +password = {{ admin_password }} |
549 | +project_id = {{ admin_tenant_name }} |
550 | |
551 | === modified file 'templates/juno/neutron.conf' |
552 | --- templates/juno/neutron.conf 2015-10-07 22:11:33 +0000 |
553 | +++ templates/juno/neutron.conf 2015-10-09 14:49:21 +0000 |
554 | @@ -98,6 +98,8 @@ |
555 | {% include "parts/section-database" %} |
556 | |
557 | [service_providers] |
558 | +service_provider=VPN:openswan:neutron.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default |
559 | service_provider=LOADBALANCER:Haproxy:neutron.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default |
560 | -service_provider=VPN:openswan:neutron.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default |
561 | +{% if not neutron_plugin or neutron_plugin != 'midonet' -%} |
562 | service_provider=FIREWALL:Iptables:neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver:default |
563 | +{% endif -%} |
564 | |
565 | === modified file 'templates/kilo/neutron.conf' |
566 | --- templates/kilo/neutron.conf 2015-10-07 22:11:33 +0000 |
567 | +++ templates/kilo/neutron.conf 2015-10-09 14:49:21 +0000 |
568 | @@ -105,9 +105,13 @@ |
569 | {% include "section-rabbitmq-oslo" %} |
570 | |
571 | [service_providers] |
572 | +service_provider=VPN:openswan:neutron_vpnaas.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default |
573 | +{% if neutron_plugin and neutron_plugin == 'midonet' -%} |
574 | +service_provider = LOADBALANCER:Midonet:midonet.neutron.services.loadbalancer.driver.MidonetLoadbalancerDriver:default |
575 | +{% else -%} |
576 | service_provider=LOADBALANCER:Haproxy:neutron_lbaas.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default |
577 | -service_provider=VPN:openswan:neutron_vpnaas.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default |
578 | service_provider=FIREWALL:Iptables:neutron_fwaas.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver:default |
579 | +{% endif -%} |
580 | |
581 | [oslo_concurrency] |
582 | lock_path = $state_path/lock |
583 | |
584 | === modified file 'tests/charmhelpers/contrib/openstack/amulet/utils.py' |
585 | --- tests/charmhelpers/contrib/openstack/amulet/utils.py 2015-09-25 14:35:35 +0000 |
586 | +++ tests/charmhelpers/contrib/openstack/amulet/utils.py 2015-10-09 14:49:21 +0000 |
587 | @@ -752,7 +752,7 @@ |
588 | self.log.debug('SSL is enabled @{}:{} ' |
589 | '({})'.format(host, port, unit_name)) |
590 | return True |
591 | - elif not port and not conf_ssl: |
592 | + elif not conf_ssl: |
593 | self.log.debug('SSL not enabled @{}:{} ' |
594 | '({})'.format(host, port, unit_name)) |
595 | return False |
596 | |
597 | === modified file 'unit_tests/test_neutron_api_context.py' |
598 | --- unit_tests/test_neutron_api_context.py 2015-10-08 11:48:15 +0000 |
599 | +++ unit_tests/test_neutron_api_context.py 2015-10-09 14:49:21 +0000 |
600 | @@ -275,6 +275,9 @@ |
601 | self.test_config.set('plumgrid-username', 'plumgrid') |
602 | self.test_config.set('plumgrid-password', 'plumgrid') |
603 | self.test_config.set('plumgrid-virtual-ip', '192.168.100.250') |
604 | + self.test_config.set('midonet-release', 'kilo/mem-1.9') |
605 | + self.test_config.set('mem-username', 'mido_user') |
606 | + self.test_config.set('mem-password', 'mido_password') |
607 | |
608 | def tearDown(self): |
609 | super(NeutronCCContextTest, self).tearDown() |
charm_lint_check #11503 neutron-api-next for celebdor mp273772
LINT FAIL: lint-test failed
LINT Results (max last 2 lines):
make: *** [lint] Error 1
ERROR:root:Make target returned non-zero.
Full lint test output: http:// paste.ubuntu. com/12711577/ 10.245. 162.77: 8080/job/ charm_lint_ check/11503/
Build: http://