Merge lp:~openstack-charmers/charms/trusty/neutron-api/0mq into lp:~openstack-charmers-archive/charms/trusty/neutron-api/next

Proposed by Liam Young
Status: Merged
Merged at revision: 95
Proposed branch: lp:~openstack-charmers/charms/trusty/neutron-api/0mq
Merge into: lp:~openstack-charmers-archive/charms/trusty/neutron-api/next
Diff against target: 747 lines (+390/-90)
14 files modified
hooks/charmhelpers/contrib/openstack/amulet/deployment.py (+25/-2)
hooks/charmhelpers/contrib/openstack/context.py (+144/-1)
hooks/charmhelpers/contrib/openstack/templates/git.upstart (+13/-0)
hooks/charmhelpers/contrib/openstack/templates/section-zeromq (+14/-0)
hooks/charmhelpers/contrib/openstack/templates/zeromq (+0/-14)
hooks/charmhelpers/contrib/openstack/utils.py (+124/-69)
hooks/charmhelpers/core/unitdata.py (+1/-1)
hooks/neutron_api_hooks.py (+19/-1)
hooks/neutron_api_utils.py (+12/-0)
metadata.yaml (+3/-0)
templates/icehouse/neutron.conf (+4/-0)
templates/kilo/neutron.conf (+3/-0)
tests/charmhelpers/contrib/openstack/amulet/deployment.py (+25/-2)
unit_tests/test_neutron_api_hooks.py (+3/-0)
To merge this branch: bzr merge lp:~openstack-charmers/charms/trusty/neutron-api/0mq
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
James Page Needs Fixing
Review via email: mp+238881@code.launchpad.net
To post a comment you must log in.
54. By Liam Young

Fix unit tests

Revision history for this message
Ryan Beisner (1chb1n) wrote :

UOSCI bot says:
This MP triggered a test on the Ubuntu OSCI system. Here is a summary of results.

#698 neutron-api-next for gnuoy mp238881
charm_lint_check

This build:
http://10.98.191.181:8080/job/charm_lint_check/698/

MP URL:
https://code.launchpad.net/~openstack-charmers/charms/trusty/neutron-api/0mq/+merge/238881

Proposed branch:
lp:~openstack-charmers/charms/trusty/neutron-api/0mq

Results summary:
    LINT OK: believed to pass, but you should confirm results

LINT Results (max last 25 lines) from
/var/lib/jenkins/workspace/charm_lint_check/make-lint.698:
I: config.yaml: option ssl_key has no default value
I: config.yaml: option os-admin-network has no default value
I: config.yaml: option nsx-controllers has no default value
I: config.yaml: option vip has no default value
I: config.yaml: option nsx-l3-uuid has no default value
I: config.yaml: option ssl_ca has no default value
I: config.yaml: option ssl_cert has no default value
I: config.yaml: option os-internal-network has no default value
I: config.yaml: option os-public-network has no default value
I: config.yaml: option nsx-tz-uuid has no default value

Ubuntu OSCI Jenkins is currently in development on a Canonical private network, but we plan to publish results to a public instance soon. Tests are triggered if the proposed branch rev changes, or if the MP is placed into "Needs review" status after being otherwise for >= 1hr. Human review of results is still recommended.
http://10.98.191.181:8080/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

UOSCI bot says:
This MP triggered a test on the Ubuntu OSCI system. Here is a summary of results.

#504 neutron-api-next for gnuoy mp238881
charm_unit_test

This build:
http://10.98.191.181:8080/job/charm_unit_test/504/

MP URL:
https://code.launchpad.net/~openstack-charmers/charms/trusty/neutron-api/0mq/+merge/238881

Proposed branch:
lp:~openstack-charmers/charms/trusty/neutron-api/0mq

Results summary:
    UNIT OK: believed to pass, but you should confirm results

UNIT Results (max last 25 lines) from
/var/lib/jenkins/workspace/charm_unit_test/unit-test.504:
Starting tests...
.......................................................
Name Stmts Miss Cover Missing
---------------------------------------------------------
hooks/neutron_api_context 80 6 93% 22, 34-36, 78, 110
hooks/neutron_api_hooks 200 18 91% 122-123, 183-184, 197, 262, 308, 327-338, 415, 423, 427-428
hooks/neutron_api_utils 99 8 92% 219, 243-255
---------------------------------------------------------
TOTAL 379 32 92%
----------------------------------------------------------------------
Ran 55 tests in 3.385s

OK

Ubuntu OSCI Jenkins is currently in development on a Canonical private network, but we plan to publish results to a public instance soon. Tests are triggered if the proposed branch rev changes, or if the MP is placed into "Needs review" status after being otherwise for >= 1hr. Human review of results is still recommended.
http://10.98.191.181:8080/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

UOSCI bot says:
This MP triggered a test on the Ubuntu OSCI system. Here is a summary of results.

#255 neutron-api-next for gnuoy mp238881
charm_amulet_test

This build:
http://10.98.191.181:8080/job/charm_amulet_test/255/

MP URL:
https://code.launchpad.net/~openstack-charmers/charms/trusty/neutron-api/0mq/+merge/238881

Proposed branch:
lp:~openstack-charmers/charms/trusty/neutron-api/0mq

Results summary:
    AMULET FAIL: amulet-test missing

AMULET Results not found.

Ubuntu OSCI Jenkins is currently in development on a Canonical private network, but we plan to publish results to a public instance soon. Tests are triggered if the proposed branch rev changes, or if the MP is placed into "Needs review" status after being otherwise for >= 1hr. Human review of results is still recommended.
http://10.98.191.181:8080/

Revision history for this message
James Page (james-page) :
review: Needs Fixing
55. By James Page

Rebase on next

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #167 neutron-api-next for gnuoy mp238881
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
  hooks/neutron_api_hooks.py:31:1: F401 'os_release' imported but unused
  make: *** [lint] Error 1

Full lint test output: http://paste.ubuntu.com/9527363/
Build: http://10.245.162.77:8080/job/charm_lint_check/167/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #201 neutron-api-next for gnuoy mp238881
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/201/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #181 neutron-api-next for gnuoy mp238881
    AMULET FAIL: no-tear-down-replace failed
    AMULET FAIL: amulet-test missing

AMULET Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.

Full amulet test output: http://paste.ubuntu.com/9527382/
Build: http://10.245.162.77:8080/job/charm_amulet_test/181/

56. By James Page

Rebase on next

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #710 neutron-api-next for gnuoy mp238881
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
  hooks/neutron_api_hooks.py:31:1: F401 'os_release' imported but unused
  make: *** [lint] Error 1

Full lint test output: http://paste.ubuntu.com/9727332/
Build: http://10.245.162.77:8080/job/charm_lint_check/710/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #895 neutron-api-next for gnuoy mp238881
    AMULET FAIL: amulet-test missing

AMULET Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.

Full amulet test output: http://paste.ubuntu.com/9727334/
Build: http://10.245.162.77:8080/job/charm_amulet_test/895/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #739 neutron-api-next for gnuoy mp238881
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/739/

57. By James Page

Use centralized zeromq template

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #843 neutron-api-next for gnuoy mp238881
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
  hooks/neutron_api_hooks.py:31:1: F401 'os_release' imported but unused
  make: *** [lint] Error 1

Full lint test output: http://paste.ubuntu.com/9783631/
Build: http://10.245.162.77:8080/job/charm_lint_check/843/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #872 neutron-api-next for gnuoy mp238881
    UNIT FAIL: unit-test failed

UNIT Results (max last 2 lines):
  FAILED (failures=1)
  make: *** [unit_test] Error 1

Full unit test output: http://paste.ubuntu.com/9783634/
Build: http://10.245.162.77:8080/job/charm_unit_test/872/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #1067 neutron-api-next for gnuoy mp238881
    AMULET FAIL: amulet-test missing

AMULET Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.

Full amulet test output: http://paste.ubuntu.com/9783642/
Build: http://10.245.162.77:8080/job/charm_amulet_test/1067/

58. By James Page

Sortout zeromq section

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #847 neutron-api-next for gnuoy mp238881
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
  hooks/neutron_api_hooks.py:31:1: F401 'os_release' imported but unused
  make: *** [lint] Error 1

Full lint test output: http://paste.ubuntu.com/9783952/
Build: http://10.245.162.77:8080/job/charm_lint_check/847/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #876 neutron-api-next for gnuoy mp238881
    UNIT FAIL: unit-test failed

UNIT Results (max last 2 lines):
  FAILED (failures=1)
  make: *** [unit_test] Error 1

Full unit test output: http://paste.ubuntu.com/9783953/
Build: http://10.245.162.77:8080/job/charm_unit_test/876/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #1071 neutron-api-next for gnuoy mp238881
    AMULET FAIL: amulet-test missing

AMULET Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.

Full amulet test output: http://paste.ubuntu.com/9783956/
Build: http://10.245.162.77:8080/job/charm_amulet_test/1071/

59. By James Page

Resync helper

60. By James Page

Resync helper

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #871 neutron-api-next for gnuoy mp238881
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
  hooks/neutron_api_hooks.py:31:1: F401 'os_release' imported but unused
  make: *** [lint] Error 1

Full lint test output: http://paste.ubuntu.com/9793805/
Build: http://10.245.162.77:8080/job/charm_lint_check/871/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #900 neutron-api-next for gnuoy mp238881
    UNIT FAIL: unit-test failed

UNIT Results (max last 2 lines):
  FAILED (failures=1)
  make: *** [unit_test] Error 1

Full unit test output: http://paste.ubuntu.com/9793810/
Build: http://10.245.162.77:8080/job/charm_unit_test/900/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #1095 neutron-api-next for gnuoy mp238881
    AMULET FAIL: amulet-test missing

AMULET Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.

Full amulet test output: http://paste.ubuntu.com/9793839/
Build: http://10.245.162.77:8080/job/charm_amulet_test/1095/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #877 neutron-api-next for gnuoy mp238881
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
  hooks/neutron_api_hooks.py:31:1: F401 'os_release' imported but unused
  make: *** [lint] Error 1

Full lint test output: http://paste.ubuntu.com/9793987/
Build: http://10.245.162.77:8080/job/charm_lint_check/877/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #906 neutron-api-next for gnuoy mp238881
    UNIT FAIL: unit-test failed

UNIT Results (max last 2 lines):
  FAILED (failures=1)
  make: *** [unit_test] Error 1

Full unit test output: http://paste.ubuntu.com/9793989/
Build: http://10.245.162.77:8080/job/charm_unit_test/906/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #1101 neutron-api-next for gnuoy mp238881
    AMULET FAIL: amulet-test missing

AMULET Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.

Full amulet test output: http://paste.ubuntu.com/9794054/
Build: http://10.245.162.77:8080/job/charm_amulet_test/1101/

61. By James Page

Rebase

62. By James Page

Rebase

63. By James Page

Add juno specific config files, drop icehouse zeromq support, add to kilo

64. By James Page

Drop files we don't need to specialize for juno

65. By James Page

Ensure check uses a neutron package for zeromq support

66. By James Page

Update headers for templates

67. By James Page

Reorder zeromq inclusion

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #2229 neutron-api-next for gnuoy mp238881
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
  hooks/neutron_api_hooks.py:31:1: F401 'os_release' imported but unused
  make: *** [lint] Error 1

Full lint test output: http://paste.ubuntu.com/10396131/
Build: http://10.245.162.77:8080/job/charm_lint_check/2229/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #2018 neutron-api-next for gnuoy mp238881
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/2018/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #2175 neutron-api-next for gnuoy mp238881
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
  ERROR subprocess encountered error code 1
  make: *** [test] Error 1

Full amulet test output: http://paste.ubuntu.com/10397170/
Build: http://10.245.162.77:8080/job/charm_amulet_test/2175/

68. By James Page

Rebase

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #2685 neutron-api-next for gnuoy mp238881
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
  hooks/neutron_api_hooks.py:31:1: F401 'os_release' imported but unused
  make: *** [lint] Error 1

Full lint test output: http://paste.ubuntu.com/10610022/
Build: http://10.245.162.77:8080/job/charm_lint_check/2685/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #2476 neutron-api-next for gnuoy mp238881
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/2476/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #2514 neutron-api-next for gnuoy mp238881
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
  ERROR subprocess encountered error code 124
  make: *** [test] Error 124

Full amulet test output: http://paste.ubuntu.com/10610269/
Build: http://10.245.162.77:8080/job/charm_amulet_test/2514/

69. By James Page

Make 0mq support >= kilo

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #2695 neutron-api-next for gnuoy mp238881
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
  hooks/neutron_api_hooks.py:31:1: F401 'os_release' imported but unused
  make: *** [lint] Error 1

Full lint test output: http://paste.ubuntu.com/10610580/
Build: http://10.245.162.77:8080/job/charm_lint_check/2695/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #2486 neutron-api-next for gnuoy mp238881
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/2486/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #2524 neutron-api-next for gnuoy mp238881
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
  ERROR subprocess encountered error code 1
  make: *** [test] Error 1

Full amulet test output: http://paste.ubuntu.com/10610801/
Build: http://10.245.162.77:8080/job/charm_amulet_test/2524/

70. By James Page

Tidy lint

71. By James Page

Rebase resync

72. By James Page

Rebase

73. By James Page

Rebase

Revision history for this message
Liam Young (gnuoy) wrote :

Approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/charmhelpers/contrib/openstack/amulet/deployment.py'
2--- hooks/charmhelpers/contrib/openstack/amulet/deployment.py 2015-03-13 12:59:38 +0000
3+++ hooks/charmhelpers/contrib/openstack/amulet/deployment.py 2015-04-01 14:20:40 +0000
4@@ -15,6 +15,7 @@
5 # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
6
7 import six
8+from collections import OrderedDict
9 from charmhelpers.contrib.amulet.deployment import (
10 AmuletDeployment
11 )
12@@ -100,12 +101,34 @@
13 """
14 (self.precise_essex, self.precise_folsom, self.precise_grizzly,
15 self.precise_havana, self.precise_icehouse,
16- self.trusty_icehouse) = range(6)
17+ self.trusty_icehouse, self.trusty_juno, self.trusty_kilo) = range(8)
18 releases = {
19 ('precise', None): self.precise_essex,
20 ('precise', 'cloud:precise-folsom'): self.precise_folsom,
21 ('precise', 'cloud:precise-grizzly'): self.precise_grizzly,
22 ('precise', 'cloud:precise-havana'): self.precise_havana,
23 ('precise', 'cloud:precise-icehouse'): self.precise_icehouse,
24- ('trusty', None): self.trusty_icehouse}
25+ ('trusty', None): self.trusty_icehouse,
26+ ('trusty', 'cloud:trusty-juno'): self.trusty_juno,
27+ ('trusty', 'cloud:trusty-kilo'): self.trusty_kilo}
28 return releases[(self.series, self.openstack)]
29+
30+ def _get_openstack_release_string(self):
31+ """Get openstack release string.
32+
33+ Return a string representing the openstack release.
34+ """
35+ releases = OrderedDict([
36+ ('precise', 'essex'),
37+ ('quantal', 'folsom'),
38+ ('raring', 'grizzly'),
39+ ('saucy', 'havana'),
40+ ('trusty', 'icehouse'),
41+ ('utopic', 'juno'),
42+ ('vivid', 'kilo'),
43+ ])
44+ if self.openstack:
45+ os_origin = self.openstack.split(':')[1]
46+ return os_origin.split('%s-' % self.series)[1].split('/')[0]
47+ else:
48+ return releases[self.series]
49
50=== modified file 'hooks/charmhelpers/contrib/openstack/context.py'
51--- hooks/charmhelpers/contrib/openstack/context.py 2015-03-19 16:58:14 +0000
52+++ hooks/charmhelpers/contrib/openstack/context.py 2015-04-01 14:20:40 +0000
53@@ -47,6 +47,7 @@
54 )
55
56 from charmhelpers.core.sysctl import create as sysctl_create
57+from charmhelpers.core.strutils import bool_from_string
58
59 from charmhelpers.core.host import (
60 list_nics,
61@@ -67,6 +68,7 @@
62 )
63 from charmhelpers.contrib.openstack.neutron import (
64 neutron_plugin_attribute,
65+ parse_data_port_mappings,
66 )
67 from charmhelpers.contrib.openstack.ip import (
68 resolve_address,
69@@ -82,7 +84,6 @@
70 is_bridge_member,
71 )
72 from charmhelpers.contrib.openstack.utils import get_host_ip
73-
74 CA_CERT_PATH = '/usr/local/share/ca-certificates/keystone_juju_ca_cert.crt'
75 ADDRESS_TYPES = ['admin', 'internal', 'public']
76
77@@ -1162,3 +1163,145 @@
78 sysctl_create(sysctl_dict,
79 '/etc/sysctl.d/50-{0}.conf'.format(charm_name()))
80 return {'sysctl': sysctl_dict}
81+
82+
83+class NeutronAPIContext(OSContextGenerator):
84+ '''
85+ Inspects current neutron-plugin-api relation for neutron settings. Return
86+ defaults if it is not present.
87+ '''
88+ interfaces = ['neutron-plugin-api']
89+
90+ def __call__(self):
91+ self.neutron_defaults = {
92+ 'l2_population': {
93+ 'rel_key': 'l2-population',
94+ 'default': False,
95+ },
96+ 'overlay_network_type': {
97+ 'rel_key': 'overlay-network-type',
98+ 'default': 'gre',
99+ },
100+ 'neutron_security_groups': {
101+ 'rel_key': 'neutron-security-groups',
102+ 'default': False,
103+ },
104+ 'network_device_mtu': {
105+ 'rel_key': 'network-device-mtu',
106+ 'default': None,
107+ },
108+ 'enable_dvr': {
109+ 'rel_key': 'enable-dvr',
110+ 'default': False,
111+ },
112+ 'enable_l3ha': {
113+ 'rel_key': 'enable-l3ha',
114+ 'default': False,
115+ },
116+ }
117+ ctxt = self.get_neutron_options({})
118+ for rid in relation_ids('neutron-plugin-api'):
119+ for unit in related_units(rid):
120+ rdata = relation_get(rid=rid, unit=unit)
121+ if 'l2-population' in rdata:
122+ ctxt.update(self.get_neutron_options(rdata))
123+
124+ return ctxt
125+
126+ def get_neutron_options(self, rdata):
127+ settings = {}
128+ for nkey in self.neutron_defaults.keys():
129+ defv = self.neutron_defaults[nkey]['default']
130+ rkey = self.neutron_defaults[nkey]['rel_key']
131+ if rkey in rdata.keys():
132+ if type(defv) is bool:
133+ settings[nkey] = bool_from_string(rdata[rkey])
134+ else:
135+ settings[nkey] = rdata[rkey]
136+ else:
137+ settings[nkey] = defv
138+ return settings
139+
140+
141+class ExternalPortContext(NeutronPortContext):
142+
143+ def __call__(self):
144+ ctxt = {}
145+ ports = config('ext-port')
146+ if ports:
147+ ports = [p.strip() for p in ports.split()]
148+ ports = self.resolve_ports(ports)
149+ if ports:
150+ ctxt = {"ext_port": ports[0]}
151+ napi_settings = NeutronAPIContext()()
152+ mtu = napi_settings.get('network_device_mtu')
153+ if mtu:
154+ ctxt['ext_port_mtu'] = mtu
155+
156+ return ctxt
157+
158+
159+class DataPortContext(NeutronPortContext):
160+
161+ def __call__(self):
162+ ports = config('data-port')
163+ if ports:
164+ portmap = parse_data_port_mappings(ports)
165+ ports = portmap.values()
166+ resolved = self.resolve_ports(ports)
167+ normalized = {get_nic_hwaddr(port): port for port in resolved
168+ if port not in ports}
169+ normalized.update({port: port for port in resolved
170+ if port in ports})
171+ if resolved:
172+ return {bridge: normalized[port] for bridge, port in
173+ six.iteritems(portmap) if port in normalized.keys()}
174+
175+ return None
176+
177+
178+class PhyNICMTUContext(DataPortContext):
179+
180+ def __call__(self):
181+ ctxt = {}
182+ mappings = super(PhyNICMTUContext, self).__call__()
183+ if mappings and mappings.values():
184+ ports = mappings.values()
185+ napi_settings = NeutronAPIContext()()
186+ mtu = napi_settings.get('network_device_mtu')
187+ if mtu:
188+ ctxt["devs"] = '\\n'.join(ports)
189+ ctxt['mtu'] = mtu
190+
191+ return ctxt
192+
193+
194+class NetworkServiceContext(OSContextGenerator):
195+
196+ def __init__(self, rel_name='quantum-network-service'):
197+ self.rel_name = rel_name
198+ self.interfaces = [rel_name]
199+
200+ def __call__(self):
201+ for rid in relation_ids(self.rel_name):
202+ for unit in related_units(rid):
203+ rdata = relation_get(rid=rid, unit=unit)
204+ ctxt = {
205+ 'keystone_host': rdata.get('keystone_host'),
206+ 'service_port': rdata.get('service_port'),
207+ 'auth_port': rdata.get('auth_port'),
208+ 'service_tenant': rdata.get('service_tenant'),
209+ 'service_username': rdata.get('service_username'),
210+ 'service_password': rdata.get('service_password'),
211+ 'quantum_host': rdata.get('quantum_host'),
212+ 'quantum_port': rdata.get('quantum_port'),
213+ 'quantum_url': rdata.get('quantum_url'),
214+ 'region': rdata.get('region'),
215+ 'service_protocol':
216+ rdata.get('service_protocol') or 'http',
217+ 'auth_protocol':
218+ rdata.get('auth_protocol') or 'http',
219+ }
220+ if context_complete(ctxt):
221+ return ctxt
222+ return {}
223
224=== added file 'hooks/charmhelpers/contrib/openstack/templates/git.upstart'
225--- hooks/charmhelpers/contrib/openstack/templates/git.upstart 1970-01-01 00:00:00 +0000
226+++ hooks/charmhelpers/contrib/openstack/templates/git.upstart 2015-04-01 14:20:40 +0000
227@@ -0,0 +1,13 @@
228+description "{{ service_description }}"
229+author "Juju {{ service_name }} Charm <juju@localhost>"
230+
231+start on runlevel [2345]
232+stop on runlevel [!2345]
233+
234+respawn
235+
236+exec start-stop-daemon --start --chuid {{ user_name }} \
237+ --chdir {{ start_dir }} --name {{ process_name }} \
238+ --exec {{ executable_name }} -- \
239+ --config-file={{ config_file }} \
240+ --log-file={{ log_file }}
241
242=== added file 'hooks/charmhelpers/contrib/openstack/templates/section-zeromq'
243--- hooks/charmhelpers/contrib/openstack/templates/section-zeromq 1970-01-01 00:00:00 +0000
244+++ hooks/charmhelpers/contrib/openstack/templates/section-zeromq 2015-04-01 14:20:40 +0000
245@@ -0,0 +1,14 @@
246+{% if zmq_host -%}
247+# ZeroMQ configuration (restart-nonce: {{ zmq_nonce }})
248+rpc_backend = zmq
249+rpc_zmq_host = {{ zmq_host }}
250+{% if zmq_redis_address -%}
251+rpc_zmq_matchmaker = redis
252+matchmaker_heartbeat_freq = 15
253+matchmaker_heartbeat_ttl = 30
254+[matchmaker_redis]
255+host = {{ zmq_redis_address }}
256+{% else -%}
257+rpc_zmq_matchmaker = ring
258+{% endif -%}
259+{% endif -%}
260
261=== removed file 'hooks/charmhelpers/contrib/openstack/templates/zeromq'
262--- hooks/charmhelpers/contrib/openstack/templates/zeromq 2015-02-26 04:21:30 +0000
263+++ hooks/charmhelpers/contrib/openstack/templates/zeromq 1970-01-01 00:00:00 +0000
264@@ -1,14 +0,0 @@
265-{% if zmq_host -%}
266-# ZeroMQ configuration (restart-nonce: {{ zmq_nonce }})
267-rpc_backend = zmq
268-rpc_zmq_host = {{ zmq_host }}
269-{% if zmq_redis_address -%}
270-rpc_zmq_matchmaker = oslo.messaging._drivers.matchmaker_redis.MatchMakerRedis
271-matchmaker_heartbeat_freq = 15
272-matchmaker_heartbeat_ttl = 30
273-[matchmaker_redis]
274-host = {{ zmq_redis_address }}
275-{% else -%}
276-rpc_zmq_matchmaker = oslo.messaging._drivers.matchmaker_ring.MatchMakerRing
277-{% endif -%}
278-{% endif -%}
279
280=== modified file 'hooks/charmhelpers/contrib/openstack/utils.py'
281--- hooks/charmhelpers/contrib/openstack/utils.py 2015-03-13 12:59:38 +0000
282+++ hooks/charmhelpers/contrib/openstack/utils.py 2015-04-01 14:20:40 +0000
283@@ -30,6 +30,10 @@
284
285 from charmhelpers.contrib.network import ip
286
287+from charmhelpers.core import (
288+ unitdata,
289+)
290+
291 from charmhelpers.core.hookenv import (
292 config,
293 log as juju_log,
294@@ -330,6 +334,21 @@
295 error_out("Invalid openstack-release specified: %s" % rel)
296
297
298+def config_value_changed(option):
299+ """
300+ Determine if config value changed since last call to this function.
301+ """
302+ hook_data = unitdata.HookData()
303+ with hook_data():
304+ db = unitdata.kv()
305+ current = config(option)
306+ saved = db.get(option)
307+ db.set(option, current)
308+ if saved is None:
309+ return False
310+ return current != saved
311+
312+
313 def save_script_rc(script_path="scripts/scriptrc", **env_vars):
314 """
315 Write an rc file in the charm-delivered directory containing
316@@ -469,82 +488,95 @@
317
318
319 def git_install_requested():
320- """Returns true if openstack-origin-git is specified."""
321- return config('openstack-origin-git') != "None"
322+ """
323+ Returns true if openstack-origin-git is specified.
324+ """
325+ return config('openstack-origin-git') is not None
326
327
328 requirements_dir = None
329
330
331-def git_clone_and_install(file_name, core_project):
332- """Clone/install all OpenStack repos specified in yaml config file."""
333+def git_clone_and_install(projects_yaml, core_project):
334+ """
335+ Clone/install all specified OpenStack repositories.
336+
337+ The expected format of projects_yaml is:
338+ repositories:
339+ - {name: keystone,
340+ repository: 'git://git.openstack.org/openstack/keystone.git',
341+ branch: 'stable/icehouse'}
342+ - {name: requirements,
343+ repository: 'git://git.openstack.org/openstack/requirements.git',
344+ branch: 'stable/icehouse'}
345+ directory: /mnt/openstack-git
346+
347+ The directory key is optional.
348+ """
349 global requirements_dir
350+ parent_dir = '/mnt/openstack-git'
351
352- if file_name == "None":
353+ if not projects_yaml:
354 return
355
356- yaml_file = os.path.join(charm_dir(), file_name)
357-
358- # clone/install the requirements project first
359- installed = _git_clone_and_install_subset(yaml_file,
360- whitelist=['requirements'])
361- if 'requirements' not in installed:
362- error_out('requirements git repository must be specified')
363-
364- # clone/install all other projects except requirements and the core project
365- blacklist = ['requirements', core_project]
366- _git_clone_and_install_subset(yaml_file, blacklist=blacklist,
367- update_requirements=True)
368-
369- # clone/install the core project
370- whitelist = [core_project]
371- installed = _git_clone_and_install_subset(yaml_file, whitelist=whitelist,
372- update_requirements=True)
373- if core_project not in installed:
374- error_out('{} git repository must be specified'.format(core_project))
375-
376-
377-def _git_clone_and_install_subset(yaml_file, whitelist=[], blacklist=[],
378- update_requirements=False):
379- """Clone/install subset of OpenStack repos specified in yaml config file."""
380- global requirements_dir
381- installed = []
382-
383- with open(yaml_file, 'r') as fd:
384- projects = yaml.load(fd)
385- for proj, val in projects.items():
386- # The project subset is chosen based on the following 3 rules:
387- # 1) If project is in blacklist, we don't clone/install it, period.
388- # 2) If whitelist is empty, we clone/install everything else.
389- # 3) If whitelist is not empty, we clone/install everything in the
390- # whitelist.
391- if proj in blacklist:
392- continue
393- if whitelist and proj not in whitelist:
394- continue
395- repo = val['repository']
396- branch = val['branch']
397- repo_dir = _git_clone_and_install_single(repo, branch,
398- update_requirements)
399- if proj == 'requirements':
400- requirements_dir = repo_dir
401- installed.append(proj)
402- return installed
403-
404-
405-def _git_clone_and_install_single(repo, branch, update_requirements=False):
406- """Clone and install a single git repository."""
407- dest_parent_dir = "/mnt/openstack-git/"
408- dest_dir = os.path.join(dest_parent_dir, os.path.basename(repo))
409-
410- if not os.path.exists(dest_parent_dir):
411- juju_log('Host dir not mounted at {}. '
412- 'Creating directory there instead.'.format(dest_parent_dir))
413- os.mkdir(dest_parent_dir)
414+ projects = yaml.load(projects_yaml)
415+ _git_validate_projects_yaml(projects, core_project)
416+
417+ if 'directory' in projects.keys():
418+ parent_dir = projects['directory']
419+
420+ for p in projects['repositories']:
421+ repo = p['repository']
422+ branch = p['branch']
423+ if p['name'] == 'requirements':
424+ repo_dir = _git_clone_and_install_single(repo, branch, parent_dir,
425+ update_requirements=False)
426+ requirements_dir = repo_dir
427+ else:
428+ repo_dir = _git_clone_and_install_single(repo, branch, parent_dir,
429+ update_requirements=True)
430+
431+
432+def _git_validate_projects_yaml(projects, core_project):
433+ """
434+ Validate the projects yaml.
435+ """
436+ _git_ensure_key_exists('repositories', projects)
437+
438+ for project in projects['repositories']:
439+ _git_ensure_key_exists('name', project.keys())
440+ _git_ensure_key_exists('repository', project.keys())
441+ _git_ensure_key_exists('branch', project.keys())
442+
443+ if projects['repositories'][0]['name'] != 'requirements':
444+ error_out('{} git repo must be specified first'.format('requirements'))
445+
446+ if projects['repositories'][-1]['name'] != core_project:
447+ error_out('{} git repo must be specified last'.format(core_project))
448+
449+
450+def _git_ensure_key_exists(key, keys):
451+ """
452+ Ensure that key exists in keys.
453+ """
454+ if key not in keys:
455+ error_out('openstack-origin-git key \'{}\' is missing'.format(key))
456+
457+
458+def _git_clone_and_install_single(repo, branch, parent_dir, update_requirements):
459+ """
460+ Clone and install a single git repository.
461+ """
462+ dest_dir = os.path.join(parent_dir, os.path.basename(repo))
463+
464+ if not os.path.exists(parent_dir):
465+ juju_log('Directory already exists at {}. '
466+ 'No need to create directory.'.format(parent_dir))
467+ os.mkdir(parent_dir)
468
469 if not os.path.exists(dest_dir):
470 juju_log('Cloning git repo: {}, branch: {}'.format(repo, branch))
471- repo_dir = install_remote(repo, dest=dest_parent_dir, branch=branch)
472+ repo_dir = install_remote(repo, dest=parent_dir, branch=branch)
473 else:
474 repo_dir = dest_dir
475
476@@ -561,16 +593,39 @@
477
478
479 def _git_update_requirements(package_dir, reqs_dir):
480- """Update from global requirements.
481+ """
482+ Update from global requirements.
483
484- Update an OpenStack git directory's requirements.txt and
485- test-requirements.txt from global-requirements.txt."""
486+ Update an OpenStack git directory's requirements.txt and
487+ test-requirements.txt from global-requirements.txt.
488+ """
489 orig_dir = os.getcwd()
490 os.chdir(reqs_dir)
491- cmd = "python update.py {}".format(package_dir)
492+ cmd = ['python', 'update.py', package_dir]
493 try:
494- subprocess.check_call(cmd.split(' '))
495+ subprocess.check_call(cmd)
496 except subprocess.CalledProcessError:
497 package = os.path.basename(package_dir)
498 error_out("Error updating {} from global-requirements.txt".format(package))
499 os.chdir(orig_dir)
500+
501+
502+def git_src_dir(projects_yaml, project):
503+ """
504+ Return the directory where the specified project's source is located.
505+ """
506+ parent_dir = '/mnt/openstack-git'
507+
508+ if not projects_yaml:
509+ return
510+
511+ projects = yaml.load(projects_yaml)
512+
513+ if 'directory' in projects.keys():
514+ parent_dir = projects['directory']
515+
516+ for p in projects['repositories']:
517+ if p['name'] == project:
518+ return os.path.join(parent_dir, os.path.basename(p['repository']))
519+
520+ return None
521
522=== modified file 'hooks/charmhelpers/core/unitdata.py'
523--- hooks/charmhelpers/core/unitdata.py 2015-02-19 04:20:01 +0000
524+++ hooks/charmhelpers/core/unitdata.py 2015-04-01 14:20:40 +0000
525@@ -443,7 +443,7 @@
526 data = hookenv.execution_environment()
527 self.conf = conf_delta = self.kv.delta(data['conf'], 'config')
528 self.rels = rels_delta = self.kv.delta(data['rels'], 'rels')
529- self.kv.set('env', data['env'])
530+ self.kv.set('env', dict(data['env']))
531 self.kv.set('unit', data['unit'])
532 self.kv.set('relid', data.get('relid'))
533 return conf_delta, rels_delta
534
535=== modified file 'hooks/neutron_api_hooks.py'
536--- hooks/neutron_api_hooks.py 2015-04-01 11:26:15 +0000
537+++ hooks/neutron_api_hooks.py 2015-04-01 14:20:40 +0000
538@@ -34,6 +34,7 @@
539 from charmhelpers.contrib.openstack.utils import (
540 configure_installation_source,
541 openstack_upgrade_available,
542+ os_requires_version,
543 sync_db_with_multi_ipv6_addresses
544 )
545
546@@ -48,7 +49,8 @@
547 register_configs,
548 restart_map,
549 services,
550- setup_ipv6
551+ setup_ipv6,
552+ get_topics,
553 )
554 from neutron_api_context import (
555 get_dvr,
556@@ -154,6 +156,8 @@
557 amqp_joined(relation_id=r_id)
558 for r_id in relation_ids('identity-service'):
559 identity_joined(rid=r_id)
560+ for rid in relation_ids('zeromq-configuration'):
561+ zeromq_configuration_relation_joined(rid)
562 [cluster_joined(rid) for rid in relation_ids('cluster')]
563
564
565@@ -424,6 +428,20 @@
566 neutron_api_relation_joined(rid=rid)
567
568
569+@hooks.hook('zeromq-configuration-relation-joined')
570+@os_requires_version('kilo', 'neutron-server')
571+def zeromq_configuration_relation_joined(relid=None):
572+ relation_set(relation_id=relid,
573+ topics=" ".join(get_topics()),
574+ users="neutron")
575+
576+
577+@hooks.hook('zeromq-configuration-relation-changed')
578+@restart_on_change(restart_map(), stopstart=True)
579+def zeromq_configuration_relation_changed():
580+ CONFIGS.write_all()
581+
582+
583 @hooks.hook('nrpe-external-master-relation-joined',
584 'nrpe-external-master-relation-changed')
585 def update_nrpe_config():
586
587=== modified file 'hooks/neutron_api_utils.py'
588--- hooks/neutron_api_utils.py 2015-03-31 07:53:39 +0000
589+++ hooks/neutron_api_utils.py 2015-04-01 14:20:40 +0000
590@@ -83,6 +83,8 @@
591 service_user='neutron'),
592 neutron_api_context.NeutronCCContext(),
593 context.SyslogContext(),
594+ context.ZeroMQContext(),
595+ context.NotificationDriverContext(),
596 context.BindHostContext(),
597 context.WorkerConfigContext()],
598 }),
599@@ -231,6 +233,16 @@
600 configs.set_release(openstack_release=new_os_rel)
601
602
603+def get_topics():
604+ return ['q-l3-plugin',
605+ 'q-firewall-plugin',
606+ 'n-lbaas-plugin',
607+ 'ipsec_driver',
608+ 'q-metering-plugin',
609+ 'q-plugin',
610+ 'neutron']
611+
612+
613 def setup_ipv6():
614 ubuntu_rel = lsb_release()['DISTRIB_CODENAME'].lower()
615 if ubuntu_rel < "trusty":
616
617=== added symlink 'hooks/zeromq-configuration-relation-changed'
618=== target is u'neutron_api_hooks.py'
619=== added symlink 'hooks/zeromq-configuration-relation-joined'
620=== target is u'neutron_api_hooks.py'
621=== modified file 'metadata.yaml'
622--- metadata.yaml 2014-10-30 03:30:36 +0000
623+++ metadata.yaml 2015-04-01 14:20:40 +0000
624@@ -34,6 +34,9 @@
625 ha:
626 interface: hacluster
627 scope: container
628+ zeromq-configuration:
629+ interface: zeromq-configuration
630+ scope: container
631 peers:
632 cluster:
633 interface: neutron-api-ha
634
635=== modified file 'templates/icehouse/neutron.conf'
636--- templates/icehouse/neutron.conf 2015-03-13 12:59:38 +0000
637+++ templates/icehouse/neutron.conf 2015-04-01 14:20:40 +0000
638@@ -1,3 +1,4 @@
639+# icehouse
640 ###############################################################################
641 # [ WARNING ]
642 # Configuration file maintained by Juju. Local changes may be overwritten.
643@@ -11,7 +12,10 @@
644 lock_path = $state_path/lock
645 bind_host = {{ bind_host }}
646 auth_strategy = keystone
647+
648+{% if notifications == 'True' -%}
649 notification_driver = neutron.openstack.common.notifier.rpc_notifier
650+{% endif -%}
651 api_workers = {{ workers }}
652 rpc_workers = {{ workers }}
653
654
655=== modified file 'templates/kilo/neutron.conf'
656--- templates/kilo/neutron.conf 2015-03-31 07:53:39 +0000
657+++ templates/kilo/neutron.conf 2015-04-01 14:20:40 +0000
658@@ -1,3 +1,4 @@
659+# kilo
660 ###############################################################################
661 # [ WARNING ]
662 # Configuration file maintained by Juju. Local changes may be overwritten.
663@@ -51,6 +52,8 @@
664 nova_admin_auth_url = {{ auth_protocol }}://{{ auth_host }}:{{ auth_port }}/v2.0
665 {% endif -%}
666
667+{% include "section-zeromq" %}
668+
669 [quotas]
670 quota_driver = neutron.db.quota_db.DbQuotaDriver
671 {% if neutron_security_groups -%}
672
673=== modified file 'tests/charmhelpers/contrib/openstack/amulet/deployment.py'
674--- tests/charmhelpers/contrib/openstack/amulet/deployment.py 2015-02-17 07:10:15 +0000
675+++ tests/charmhelpers/contrib/openstack/amulet/deployment.py 2015-04-01 14:20:40 +0000
676@@ -15,6 +15,7 @@
677 # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
678
679 import six
680+from collections import OrderedDict
681 from charmhelpers.contrib.amulet.deployment import (
682 AmuletDeployment
683 )
684@@ -100,12 +101,34 @@
685 """
686 (self.precise_essex, self.precise_folsom, self.precise_grizzly,
687 self.precise_havana, self.precise_icehouse,
688- self.trusty_icehouse) = range(6)
689+ self.trusty_icehouse, self.trusty_juno, self.trusty_kilo) = range(8)
690 releases = {
691 ('precise', None): self.precise_essex,
692 ('precise', 'cloud:precise-folsom'): self.precise_folsom,
693 ('precise', 'cloud:precise-grizzly'): self.precise_grizzly,
694 ('precise', 'cloud:precise-havana'): self.precise_havana,
695 ('precise', 'cloud:precise-icehouse'): self.precise_icehouse,
696- ('trusty', None): self.trusty_icehouse}
697+ ('trusty', None): self.trusty_icehouse,
698+ ('trusty', 'cloud:trusty-juno'): self.trusty_juno,
699+ ('trusty', 'cloud:trusty-kilo'): self.trusty_kilo}
700 return releases[(self.series, self.openstack)]
701+
702+ def _get_openstack_release_string(self):
703+ """Get openstack release string.
704+
705+ Return a string representing the openstack release.
706+ """
707+ releases = OrderedDict([
708+ ('precise', 'essex'),
709+ ('quantal', 'folsom'),
710+ ('raring', 'grizzly'),
711+ ('saucy', 'havana'),
712+ ('trusty', 'icehouse'),
713+ ('utopic', 'juno'),
714+ ('vivid', 'kilo'),
715+ ])
716+ if self.openstack:
717+ os_origin = self.openstack.split(':')[1]
718+ return os_origin.split('%s-' % self.series)[1].split('/')[0]
719+ else:
720+ return releases[self.series]
721
722=== modified file 'unit_tests/test_neutron_api_hooks.py'
723--- unit_tests/test_neutron_api_hooks.py 2015-04-01 11:26:15 +0000
724+++ unit_tests/test_neutron_api_hooks.py 2015-04-01 14:20:40 +0000
725@@ -44,6 +44,7 @@
726 'log',
727 'open_port',
728 'openstack_upgrade_available',
729+ 'os_requires_version',
730 'relation_get',
731 'relation_ids',
732 'relation_set',
733@@ -117,12 +118,14 @@
734 _amqp_rel_joined = self.patch('amqp_joined')
735 _id_rel_joined = self.patch('identity_joined')
736 _id_cluster_joined = self.patch('cluster_joined')
737+ _zmq_joined = self.patch('zeromq_configuration_relation_joined')
738 self._call_hook('config-changed')
739 self.assertTrue(_n_api_rel_joined.called)
740 self.assertTrue(_n_plugin_api_rel_joined.called)
741 self.assertTrue(_amqp_rel_joined.called)
742 self.assertTrue(_id_rel_joined.called)
743 self.assertTrue(_id_cluster_joined.called)
744+ self.assertTrue(_zmq_joined.called)
745 self.assertTrue(self.CONFIGS.write_all.called)
746 self.assertTrue(self.do_openstack_upgrade.called)
747 self.assertTrue(self.apt_install.called)

Subscribers

People subscribed via source and target branches