Merge lp:~billy-olsen/charms/trusty/cinder/1468306 into lp:~openstack-charmers-archive/charms/trusty/cinder/next

Proposed by Billy Olsen on 2016-02-16
Status: Merged
Merged at revision: 147
Proposed branch: lp:~billy-olsen/charms/trusty/cinder/1468306
Merge into: lp:~openstack-charmers-archive/charms/trusty/cinder/next
Diff against target: 94 lines (+34/-1)
6 files modified
hooks/cinder_contexts.py (+15/-0)
hooks/cinder_utils.py (+2/-1)
templates/cinder.conf (+4/-0)
templates/icehouse/cinder.conf (+4/-0)
templates/kilo/cinder.conf (+4/-0)
unit_tests/test_cinder_contexts.py (+5/-0)
To merge this branch: bzr merge lp:~billy-olsen/charms/trusty/cinder/1468306
Reviewer Review Type Date Requested Status
James Page 2016-02-16 Approve on 2016-02-17
Review via email: mp+286223@code.launchpad.net
To post a comment you must log in.

charm_lint_check #663 cinder-next for billy-olsen mp286223
    LINT OK: passed

Build: http://10.245.162.36:8080/job/charm_lint_check/663/

charm_unit_test #570 cinder-next for billy-olsen mp286223
    UNIT OK: passed

Build: http://10.245.162.36:8080/job/charm_unit_test/570/

charm_amulet_test #270 cinder-next for billy-olsen mp286223
    AMULET OK: passed

Build: http://10.245.162.36:8080/job/charm_amulet_test/270/

James Page (james-page) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/cinder_contexts.py'
2--- hooks/cinder_contexts.py 2015-09-30 11:07:30 +0000
3+++ hooks/cinder_contexts.py 2016-02-16 18:51:03 +0000
4@@ -154,3 +154,18 @@
5 "backends configured.", level=WARNING)
6
7 return ctxt
8+
9+
10+class RegionContext(OSContextGenerator):
11+ """Provides context data regarding the region the service is in.
12+
13+ This context provides the region that is configured by the admin via the
14+ region option in the config settings for the charm. If no region config
15+ is available, then this will provide an empty context.
16+ """
17+ def __call__(self):
18+ region = config('region')
19+ if region:
20+ return {'region': region}
21+ else:
22+ return {}
23
24=== modified file 'hooks/cinder_utils.py'
25--- hooks/cinder_utils.py 2016-01-06 21:17:12 +0000
26+++ hooks/cinder_utils.py 2016-02-16 18:51:03 +0000
27@@ -203,7 +203,8 @@
28 service='cinder',
29 service_user='cinder'),
30 context.BindHostContext(),
31- context.WorkerConfigContext()],
32+ context.WorkerConfigContext(),
33+ cinder_contexts.RegionContext()],
34 'services': ['cinder-api', 'cinder-volume', 'cinder-backup',
35 'cinder-scheduler', 'haproxy']
36 }),
37
38=== modified file 'templates/cinder.conf'
39--- templates/cinder.conf 2014-04-12 19:12:09 +0000
40+++ templates/cinder.conf 2016-02-16 18:51:03 +0000
41@@ -57,6 +57,10 @@
42 glance_api_version = {{ glance_api_version }}
43 {% endif -%}
44
45+{% if region -%}
46+os_region_name = {{ region }}
47+{% endif -%}
48+
49 {% if user_config_flags -%}
50 {% for key, value in user_config_flags.iteritems() -%}
51 {{ key }} = {{ value }}
52
53=== modified file 'templates/icehouse/cinder.conf'
54--- templates/icehouse/cinder.conf 2015-02-19 19:37:26 +0000
55+++ templates/icehouse/cinder.conf 2016-02-16 18:51:03 +0000
56@@ -48,6 +48,10 @@
57 glance_api_version = {{ glance_api_version }}
58 {% endif -%}
59
60+{% if region -%}
61+os_region_name = {{ region }}
62+{% endif -%}
63+
64 {% if user_config_flags -%}
65 {% for key, value in user_config_flags.iteritems() -%}
66 {{ key }} = {{ value }}
67
68=== modified file 'templates/kilo/cinder.conf'
69--- templates/kilo/cinder.conf 2015-12-15 10:20:01 +0000
70+++ templates/kilo/cinder.conf 2016-02-16 18:51:03 +0000
71@@ -45,6 +45,10 @@
72 glance_api_version = {{ glance_api_version }}
73 {% endif -%}
74
75+{% if region -%}
76+os_region_name = {{ region }}
77+{% endif -%}
78+
79 {% if user_config_flags -%}
80 {% for key, value in user_config_flags.iteritems() -%}
81 {{ key }} = {{ value }}
82
83=== modified file 'unit_tests/test_cinder_contexts.py'
84--- unit_tests/test_cinder_contexts.py 2015-09-11 10:36:23 +0000
85+++ unit_tests/test_cinder_contexts.py 2016-02-16 18:51:03 +0000
86@@ -341,3 +341,8 @@
87 u'cinder.volume.drivers.OtherDriver']]}}
88
89 self.assertEquals(ctxt, exp)
90+
91+ def test_region_context(self):
92+ self.config.return_value = 'two'
93+ ctxt = contexts.RegionContext()()
94+ self.assertEqual('two', ctxt['region'])

Subscribers

People subscribed via source and target branches