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

Proposed by Liam Young
Status: Rejected
Rejected by: James Page
Proposed branch: lp:~openstack-charmers/charms/trusty/glance/0mq
Merge into: lp:~openstack-charmers-archive/charms/trusty/glance/next
Diff against target: 697 lines (+371/-93)
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/glance_relations.py (+15/-0)
hooks/glance_utils.py (+2/-0)
metadata.yaml (+3/-0)
templates/icehouse/glance-api.conf (+0/-4)
templates/kilo/glance-api.conf (+2/-0)
templates/parts/rabbitmq (+3/-0)
tests/charmhelpers/contrib/openstack/amulet/deployment.py (+25/-2)
To merge this branch: bzr merge lp:~openstack-charmers/charms/trusty/glance/0mq
Reviewer Review Type Date Requested Status
Ryan Beisner (community) Needs Fixing
James Page Disapprove
Review via email: mp+238877@code.launchpad.net
To post a comment you must log in.
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.

#693 glance-next for gnuoy mp238877
charm_lint_check

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

MP URL:
https://code.launchpad.net/~openstack-charmers/charms/trusty/glance/0mq/+merge/238877

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

Results summary:
    LINT FAIL: lint-check failed

LINT Results (max last 25 lines) from
/var/lib/jenkins/workspace/charm_lint_check/make-lint.693:
Running flake8 tests:
hooks/glance_relations.py:306:80: E501 line too long (86 > 79 characters)
make: *** [lint] Error 1

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.

#499 glance-next for gnuoy mp238877
charm_unit_test

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

MP URL:
https://code.launchpad.net/~openstack-charmers/charms/trusty/glance/0mq/+merge/238877

Proposed branch:
lp:~openstack-charmers/charms/trusty/glance/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.499:
test_postgresql_db_joined (unit_tests.test_glance_relations.GlanceRelationTests) ... ok
test_postgresql_joined_with_db (unit_tests.test_glance_relations.GlanceRelationTests) ... ok
test_relation_broken (unit_tests.test_glance_relations.GlanceRelationTests) ... ok
test_upgrade_charm (unit_tests.test_glance_relations.GlanceRelationTests) ... ok
test_ensure_ceph_pool (unit_tests.test_glance_utils.TestGlanceUtils) ... ok
test_ensure_ceph_pool_already_exists (unit_tests.test_glance_utils.TestGlanceUtils) ... ok
It migrates database with cinder-manage ... ok
test_openstack_upgrade_leader (unit_tests.test_glance_utils.TestGlanceUtils) ... ok
test_openstack_upgrade_not_leader (unit_tests.test_glance_utils.TestGlanceUtils) ... ok
test_register_configs_apache (unit_tests.test_glance_utils.TestGlanceUtils) ... ok
test_register_configs_apache24 (unit_tests.test_glance_utils.TestGlanceUtils) ... ok
test_register_configs_ceph (unit_tests.test_glance_utils.TestGlanceUtils) ... ok
test_restart_map (unit_tests.test_glance_utils.TestGlanceUtils) ... ok

Name Stmts Miss Cover Missing
------------------------------------------------------
hooks/glance_contexts 48 6 88% 77-85, 100
hooks/glance_relations 219 11 95% 290-291, 311-322, 455, 461
hooks/glance_utils 91 8 91% 158, 251-263
------------------------------------------------------
TOTAL 358 25 93%
----------------------------------------------------------------------
Ran 65 tests in 3.256s

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/

68. By Liam Young

Fix lint

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.

#701 glance-next for gnuoy mp238877
charm_lint_check

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

MP URL:
https://code.launchpad.net/~openstack-charmers/charms/trusty/glance/0mq/+merge/238877

Proposed branch:
lp:~openstack-charmers/charms/trusty/glance/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.701:
Running flake8 tests:
OK
Running charm proof:
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 haproxy-server-timeout has no default value
I: config.yaml: option vip has no default value
I: config.yaml: option haproxy-client-timeout 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
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.

#507 glance-next for gnuoy mp238877
charm_unit_test

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

MP URL:
https://code.launchpad.net/~openstack-charmers/charms/trusty/glance/0mq/+merge/238877

Proposed branch:
lp:~openstack-charmers/charms/trusty/glance/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.507:
test_postgresql_db_joined (unit_tests.test_glance_relations.GlanceRelationTests) ... ok
test_postgresql_joined_with_db (unit_tests.test_glance_relations.GlanceRelationTests) ... ok
test_relation_broken (unit_tests.test_glance_relations.GlanceRelationTests) ... ok
test_upgrade_charm (unit_tests.test_glance_relations.GlanceRelationTests) ... ok
test_ensure_ceph_pool (unit_tests.test_glance_utils.TestGlanceUtils) ... ok
test_ensure_ceph_pool_already_exists (unit_tests.test_glance_utils.TestGlanceUtils) ... ok
It migrates database with cinder-manage ... ok
test_openstack_upgrade_leader (unit_tests.test_glance_utils.TestGlanceUtils) ... ok
test_openstack_upgrade_not_leader (unit_tests.test_glance_utils.TestGlanceUtils) ... ok
test_register_configs_apache (unit_tests.test_glance_utils.TestGlanceUtils) ... ok
test_register_configs_apache24 (unit_tests.test_glance_utils.TestGlanceUtils) ... ok
test_register_configs_ceph (unit_tests.test_glance_utils.TestGlanceUtils) ... ok
test_restart_map (unit_tests.test_glance_utils.TestGlanceUtils) ... ok

Name Stmts Miss Cover Missing
------------------------------------------------------
hooks/glance_contexts 48 6 88% 77-85, 100
hooks/glance_relations 220 12 95% 290-291, 307, 312-323, 456, 462
hooks/glance_utils 91 8 91% 158, 251-263
------------------------------------------------------
TOTAL 359 26 93%
----------------------------------------------------------------------
Ran 65 tests in 3.802s

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
James Page (james-page) wrote :

As glance only uses messaging for notifications, let leave this for this cycle and review again once ZMQ + notifications works!

review: Disapprove
69. By James Page

Rebase on next

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

charm_lint_check #156 glance-next for gnuoy mp238877
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/156/

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

charm_unit_test #190 glance-next for gnuoy mp238877
    UNIT OK: passed

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

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

charm_amulet_test #170 glance-next for gnuoy mp238877
    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/9527197/
Build: http://10.245.162.77:8080/job/charm_amulet_test/170/

70. By James Page

Resync helper

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

charm_unit_test #896 glance-next for gnuoy mp238877
    UNIT FAIL: unit-test failed

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

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

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

charm_lint_check #867 glance-next for gnuoy mp238877
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/867/

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

charm_amulet_test #1091 glance-next for gnuoy mp238877
    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/9793832/
Build: http://10.245.162.77:8080/job/charm_amulet_test/1091/

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

FYI, deploy tests fail with:

12:17:47 2015-01-20 12:17:47 [ERROR] deployer.env: The following units had errors:
12:17:47 unit: glance/0: machine: 6 agent-state: error details: hook failed: "install"

2015-01-20 12:17:32 INFO juju.worker.uniter uniter.go:480 running "install" hook
2015-01-20 12:17:32 INFO install Traceback (most recent call last):
2015-01-20 12:17:32 INFO install File "/var/lib/juju/agents/unit-glance-0/charm/hooks/install", line 4, in <module>
2015-01-20 12:17:32 INFO install from glance_utils import (
2015-01-20 12:17:32 INFO install File "/var/lib/juju/agents/unit-glance-0/charm/hooks/glance_utils.py", line 6, in <module>
2015-01-20 12:17:32 INFO install import glance_contexts
2015-01-20 12:17:32 INFO install File "/var/lib/juju/agents/unit-glance-0/charm/hooks/glance_contexts.py", line 8, in <module>
2015-01-20 12:17:32 INFO install from charmhelpers.contrib.openstack.context import (
2015-01-20 12:17:32 INFO install File "/var/lib/juju/agents/unit-glance-0/charm/hooks/charmhelpers/contrib/openstack/context.py", line 37, in <module>
2015-01-20 12:17:32 INFO install from charmhelpers.contrib.hahelpers.cluster import (
2015-01-20 12:17:32 INFO install File "/var/lib/juju/agents/unit-glance-0/charm/hooks/charmhelpers/contrib/hahelpers/cluster.py", line 32, in <module>
2015-01-20 12:17:32 INFO install from charmhelpers.core.decorators import (
2015-01-20 12:17:32 INFO install ImportError: No module named decorators
2015-01-20 12:17:32 ERROR juju.worker.uniter uniter.go:486 hook failed: exit status 1

review: Needs Fixing
71. By James Page

Add missing file

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

charm_lint_check #1159 glance-next for gnuoy mp238877
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/1159/

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

charm_unit_test #1151 glance-next for gnuoy mp238877
    UNIT OK: passed

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

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

charm_amulet_test #1322 glance-next for gnuoy mp238877
    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/9882485/
Build: http://10.245.162.77:8080/job/charm_amulet_test/1322/

72. By James Page

Rebase

73. By James Page

Fixup merge problem

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

charm_lint_check #2681 glance-next for gnuoy mp238877
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/2681/

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

charm_unit_test #2472 glance-next for gnuoy mp238877
    UNIT OK: passed

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

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

charm_amulet_test #2510 glance-next for gnuoy mp238877
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
  make: ERROR:root:Make target returned non-zero.
*** [test] Error 1

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

74. By James Page

Rebase

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

charm_lint_check #2968 glance-next for gnuoy mp238877
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/2968/

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

charm_unit_test #2759 glance-next for gnuoy mp238877
    UNIT OK: passed

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

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

charm_amulet_test #2750 glance-next for gnuoy mp238877
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/2750/

75. By James Page

Rebase and resync

Unmerged revisions

75. By James Page

Rebase and resync

74. By James Page

Rebase

73. By James Page

Fixup merge problem

72. By James Page

Rebase

71. By James Page

Add missing file

70. By James Page

Resync helper

69. By James Page

Rebase on next

68. By Liam Young

Fix lint

67. By Liam Young

Merged next branch in

66. By Liam Young

Sync charmhelpers

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:58:26 +0000
3+++ hooks/charmhelpers/contrib/openstack/amulet/deployment.py 2015-03-30 15:56:21 +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-18 12:31:27 +0000
52+++ hooks/charmhelpers/contrib/openstack/context.py 2015-03-30 15:56:21 +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-03-30 15:56:21 +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-03-30 15:56:21 +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-24 12:37:31 +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:58:26 +0000
282+++ hooks/charmhelpers/contrib/openstack/utils.py 2015-03-30 15:56:21 +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 00:08:30 +0000
524+++ hooks/charmhelpers/core/unitdata.py 2015-03-30 15:56:21 +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/glance_relations.py'
536--- hooks/glance_relations.py 2015-02-26 13:32:12 +0000
537+++ hooks/glance_relations.py 2015-03-30 15:56:21 +0000
538@@ -56,6 +56,7 @@
539 configure_installation_source,
540 get_os_codename_package,
541 openstack_upgrade_available,
542+ os_requires_version,
543 lsb_release,
544 sync_db_with_multi_ipv6_addresses
545 )
546@@ -330,6 +331,8 @@
547 [keystone_joined(rid) for rid in relation_ids('identity-service')]
548 [image_service_joined(rid) for rid in relation_ids('image-service')]
549 [cluster_joined(rid) for rid in relation_ids('cluster')]
550+ for rid in relation_ids('zeromq-configuration'):
551+ zeromq_configuration_joined(rid)
552 for r_id in relation_ids('ha'):
553 ha_relation_joined(relation_id=r_id)
554
555@@ -483,6 +486,18 @@
556 CONFIGS.write(GLANCE_API_CONF)
557
558
559+@hooks.hook('zeromq-configuration-relation-joined')
560+@os_requires_version('juno', 'glance-common')
561+def zeromq_configuration_joined(rid=None):
562+ relation_set(relation_id=rid, users="glance")
563+
564+
565+@hooks.hook('zeromq-configuration-relation-changed')
566+@restart_on_change(restart_map(), stopstart=True)
567+def zeromq_configuration_changed():
568+ CONFIGS.write(GLANCE_API_CONF)
569+
570+
571 @hooks.hook('nrpe-external-master-relation-joined',
572 'nrpe-external-master-relation-changed')
573 def update_nrpe_config():
574
575=== modified file 'hooks/glance_utils.py'
576--- hooks/glance_utils.py 2015-02-20 10:33:48 +0000
577+++ hooks/glance_utils.py 2015-03-30 15:56:21 +0000
578@@ -100,6 +100,8 @@
579 glance_contexts.HAProxyContext(),
580 context.SyslogContext(),
581 glance_contexts.LoggingConfigContext(),
582+ context.ZeroMQContext(),
583+ context.NotificationDriverContext(),
584 glance_contexts.GlanceIPv6Context(),
585 context.WorkerConfigContext(),
586 glance_contexts.MultiStoreContext(),
587
588=== added symlink 'hooks/upgrade-charm'
589=== target is u'glance_relations.py'
590=== added symlink 'hooks/zeromq-configuration-relation-changed'
591=== target is u'glance_relations.py'
592=== added symlink 'hooks/zeromq-configuration-relation-departed'
593=== target is u'glance_relations.py'
594=== added symlink 'hooks/zeromq-configuration-relation-joined'
595=== target is u'glance_relations.py'
596=== modified file 'metadata.yaml'
597--- metadata.yaml 2014-10-30 03:30:35 +0000
598+++ metadata.yaml 2015-03-30 15:56:21 +0000
599@@ -30,6 +30,9 @@
600 ha:
601 interface: hacluster
602 scope: container
603+ zeromq-configuration:
604+ interface: zeromq-configuration
605+ scope: container
606 peers:
607 cluster:
608 interface: glance-ha
609
610=== modified file 'templates/icehouse/glance-api.conf'
611--- templates/icehouse/glance-api.conf 2014-11-13 02:54:21 +0000
612+++ templates/icehouse/glance-api.conf 2015-03-30 15:56:21 +0000
613@@ -38,10 +38,6 @@
614
615 {% include "parts/rabbitmq" %}
616
617-{% if rabbitmq_host or rabbitmq_hosts -%}
618-notification_driver = rabbit
619-{% endif -%}
620-
621 filesystem_store_datadir = /var/lib/glance/images/
622
623 {% if swift_store -%}
624
625=== modified file 'templates/kilo/glance-api.conf'
626--- templates/kilo/glance-api.conf 2015-03-25 09:25:38 +0000
627+++ templates/kilo/glance-api.conf 2015-03-30 15:56:21 +0000
628@@ -65,6 +65,8 @@
629 image_cache_dir = /var/lib/glance/image-cache/
630 db_enforce_mysql_charset = False
631
632+{% include "section-zeromq" %}
633+
634 [glance_store]
635 filesystem_store_datadir = /var/lib/glance/images/
636
637
638=== modified file 'templates/parts/rabbitmq'
639--- templates/parts/rabbitmq 2014-09-11 07:05:30 +0000
640+++ templates/parts/rabbitmq 2015-03-30 15:56:21 +0000
641@@ -18,4 +18,7 @@
642 kombu_ssl_ca_certs = {{ rabbit_ssl_ca }}
643 {% endif -%}
644 {% endif -%}
645+{% if notifications == 'True' -%}
646+notification_driver = rabbit
647+{% endif -%}
648 {% endif -%}
649
650=== modified file 'tests/charmhelpers/contrib/openstack/amulet/deployment.py'
651--- tests/charmhelpers/contrib/openstack/amulet/deployment.py 2015-03-13 12:58:26 +0000
652+++ tests/charmhelpers/contrib/openstack/amulet/deployment.py 2015-03-30 15:56:21 +0000
653@@ -15,6 +15,7 @@
654 # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
655
656 import six
657+from collections import OrderedDict
658 from charmhelpers.contrib.amulet.deployment import (
659 AmuletDeployment
660 )
661@@ -100,12 +101,34 @@
662 """
663 (self.precise_essex, self.precise_folsom, self.precise_grizzly,
664 self.precise_havana, self.precise_icehouse,
665- self.trusty_icehouse) = range(6)
666+ self.trusty_icehouse, self.trusty_juno, self.trusty_kilo) = range(8)
667 releases = {
668 ('precise', None): self.precise_essex,
669 ('precise', 'cloud:precise-folsom'): self.precise_folsom,
670 ('precise', 'cloud:precise-grizzly'): self.precise_grizzly,
671 ('precise', 'cloud:precise-havana'): self.precise_havana,
672 ('precise', 'cloud:precise-icehouse'): self.precise_icehouse,
673- ('trusty', None): self.trusty_icehouse}
674+ ('trusty', None): self.trusty_icehouse,
675+ ('trusty', 'cloud:trusty-juno'): self.trusty_juno,
676+ ('trusty', 'cloud:trusty-kilo'): self.trusty_kilo}
677 return releases[(self.series, self.openstack)]
678+
679+ def _get_openstack_release_string(self):
680+ """Get openstack release string.
681+
682+ Return a string representing the openstack release.
683+ """
684+ releases = OrderedDict([
685+ ('precise', 'essex'),
686+ ('quantal', 'folsom'),
687+ ('raring', 'grizzly'),
688+ ('saucy', 'havana'),
689+ ('trusty', 'icehouse'),
690+ ('utopic', 'juno'),
691+ ('vivid', 'kilo'),
692+ ])
693+ if self.openstack:
694+ os_origin = self.openstack.split(':')[1]
695+ return os_origin.split('%s-' % self.series)[1].split('/')[0]
696+ else:
697+ return releases[self.series]

Subscribers

People subscribed via source and target branches