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

Proposed by Billy Olsen
Status: Merged
Merged at revision: 219
Proposed branch: lp:~billy-olsen/charms/trusty/nova-cloud-controller/1468306
Merge into: lp:~openstack-charmers-archive/charms/trusty/nova-cloud-controller/next
Diff against target: 211 lines (+50/-6)
8 files modified
hooks/nova_cc_hooks.py (+10/-0)
templates/icehouse/nova.conf (+3/-0)
templates/juno/nova.conf (+2/-0)
templates/kilo/nova.conf (+2/-0)
templates/mitaka/nova.conf (+2/-0)
templates/parts/cinder (+5/-0)
unit_tests/test_nova_cc_contexts.py (+5/-2)
unit_tests/test_nova_cc_hooks.py (+21/-4)
To merge this branch: bzr merge lp:~billy-olsen/charms/trusty/nova-cloud-controller/1468306
Reviewer Review Type Date Requested Status
James Page Needs Fixing
Review via email: mp+286221@code.launchpad.net
To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #660 nova-cloud-controller-next for billy-olsen mp286221
    LINT OK: passed

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

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

charm_unit_test #571 nova-cloud-controller-next for billy-olsen mp286221
    UNIT OK: passed

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

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

charm_amulet_test #267 nova-cloud-controller-next for billy-olsen mp286221
    AMULET OK: passed

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

Revision history for this message
James Page (james-page) wrote :

Billy - looks OK just a couple of niggles

review: Needs Fixing
216. By Billy Olsen

Merge with trunk.

217. By Billy Olsen

Update code with feedback from code review:

1. Rebase
2. Update the new mitaka/nova.conf template
3. Add related_unit call to get the units

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

charm_lint_check #919 nova-cloud-controller-next for billy-olsen mp286221
    LINT OK: passed

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

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

charm_unit_test #818 nova-cloud-controller-next for billy-olsen mp286221
    UNIT OK: passed

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

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

charm_amulet_test #367 nova-cloud-controller-next for billy-olsen mp286221
    AMULET OK: passed

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/nova_cc_hooks.py'
2--- hooks/nova_cc_hooks.py 2016-02-16 21:52:04 +0000
3+++ hooks/nova_cc_hooks.py 2016-02-19 16:18:10 +0000
4@@ -265,6 +265,13 @@
5 [cluster_joined(rid) for rid in relation_ids('cluster')]
6 update_nrpe_config()
7
8+ # If the region value has changed, notify the cloud-compute relations
9+ # to ensure the value is propagated to the compute nodes.
10+ if config_value_changed('region'):
11+ for rid in relation_ids('cloud-compute'):
12+ for unit in related_units(rid):
13+ compute_changed(rid, unit)
14+
15 update_nova_consoleauth_config()
16
17
18@@ -604,6 +611,7 @@
19 # (comment from bash vers) XXX Should point to VIP if clustered, or
20 # this may not even be needed.
21 'ec2_host': unit_get('private-address'),
22+ 'region': config('region')
23 }
24 # update relation setting if we're attempting to restart remote
25 # services
26@@ -617,6 +625,8 @@
27 @hooks.hook('cloud-compute-relation-changed')
28 def compute_changed(rid=None, unit=None):
29 rel_settings = relation_get(rid=rid, unit=unit)
30+ if not rel_settings.get('region', None) == config('region'):
31+ relation_set(relation_id=rid, region=config('region'))
32 if 'migration_auth_type' not in rel_settings:
33 return
34 if rel_settings['migration_auth_type'] == 'ssh':
35
36=== modified file 'templates/icehouse/nova.conf'
37--- templates/icehouse/nova.conf 2015-09-17 20:15:37 +0000
38+++ templates/icehouse/nova.conf 2016-02-19 16:18:10 +0000
39@@ -130,6 +130,9 @@
40
41 {% if volume_service -%}
42 volume_api_class=nova.volume.cinder.API
43+{% if volume_service == 'cinder' -%}
44+os_region_name = {{ region }}
45+{% endif -%}
46 {% endif -%}
47
48 {% if user_config_flags -%}
49
50=== modified file 'templates/juno/nova.conf'
51--- templates/juno/nova.conf 2016-01-11 17:47:12 +0000
52+++ templates/juno/nova.conf 2016-02-19 16:18:10 +0000
53@@ -163,6 +163,8 @@
54 admin_password = {{ admin_password }}
55 {% endif -%}
56
57+{% include "parts/cinder" %}
58+
59 [osapi_v3]
60 enabled=True
61
62
63=== modified file 'templates/kilo/nova.conf'
64--- templates/kilo/nova.conf 2015-09-17 20:15:37 +0000
65+++ templates/kilo/nova.conf 2016-02-19 16:18:10 +0000
66@@ -148,6 +148,8 @@
67
68 {% include "section-keystone-authtoken" %}
69
70+{% include "parts/cinder" %}
71+
72 [osapi_v3]
73 enabled=True
74
75
76=== modified file 'templates/mitaka/nova.conf'
77--- templates/mitaka/nova.conf 2016-02-12 11:53:43 +0000
78+++ templates/mitaka/nova.conf 2016-02-19 16:18:10 +0000
79@@ -157,6 +157,8 @@
80 region = {{ region }}
81 {% endif -%}
82
83+{% include "parts/cinder" %}
84+
85 [osapi_v3]
86 enabled=True
87
88
89=== added file 'templates/parts/cinder'
90--- templates/parts/cinder 1970-01-01 00:00:00 +0000
91+++ templates/parts/cinder 2016-02-19 16:18:10 +0000
92@@ -0,0 +1,5 @@
93+{% if volume_service and volume_service == 'cinder' -%}
94+[cinder]
95+os_region_name = {{ region }}
96+{% endif -%}
97+
98
99=== modified file 'unit_tests/test_nova_cc_contexts.py'
100--- unit_tests/test_nova_cc_contexts.py 2015-09-29 06:46:46 +0000
101+++ unit_tests/test_nova_cc_contexts.py 2016-02-19 16:18:10 +0000
102@@ -153,6 +153,7 @@
103
104 @mock.patch.object(neutron, 'network_manager')
105 @mock.patch('charmhelpers.contrib.hahelpers.cluster.https')
106+ @mock.patch('charmhelpers.contrib.openstack.context.kv')
107 @mock.patch('charmhelpers.contrib.openstack.context.'
108 'get_address_in_network')
109 @mock.patch('charmhelpers.contrib.openstack.context.'
110@@ -162,7 +163,7 @@
111 @mock.patch('charmhelpers.contrib.openstack.context.relation_ids')
112 def test_haproxy_context(self, mock_relation_ids, mock_get_ipv6_addr,
113 mock_local_unit, mock_get_netmask_for_address,
114- mock_get_address_in_network, mock_https,
115+ mock_get_address_in_network, mock_kv, mock_https,
116 mock_network_manager):
117 mock_network_manager.return_value = 'neutron'
118 mock_https.return_value = False
119@@ -172,6 +173,7 @@
120
121 @mock.patch.object(neutron, 'network_manager')
122 @mock.patch('charmhelpers.contrib.hahelpers.cluster.https')
123+ @mock.patch('charmhelpers.contrib.openstack.context.kv')
124 @mock.patch('charmhelpers.contrib.openstack.context.'
125 'get_address_in_network')
126 @mock.patch('charmhelpers.contrib.openstack.context.'
127@@ -183,7 +185,8 @@
128 mock_get_ipv6_addr, mock_local_unit,
129 mock_get_netmask_for_address,
130 mock_get_address_in_network,
131- mock_https, mock_network_manager):
132+ mock_kv, mock_https,
133+ mock_network_manager):
134 mock_network_manager.return_value = 'neutron'
135 mock_https.return_value = False
136 self.is_relation_made.return_value = True
137
138=== modified file 'unit_tests/test_nova_cc_hooks.py'
139--- unit_tests/test_nova_cc_hooks.py 2016-01-08 12:30:31 +0000
140+++ unit_tests/test_nova_cc_hooks.py 2016-02-19 16:18:10 +0000
141@@ -33,6 +33,7 @@
142 'openstack_upgrade_available',
143 'cmd_all_services',
144 'config',
145+ 'config_value_changed',
146 'determine_endpoints',
147 'determine_packages',
148 'determine_ports',
149@@ -44,6 +45,7 @@
150 'local_unit',
151 'log',
152 'os_release',
153+ 'related_units',
154 'relation_get',
155 'relation_set',
156 'relation_ids',
157@@ -155,9 +157,8 @@
158 self.assertTrue(self.save_script_rc.called)
159 mock_filter_packages.assert_called_with([])
160
161- @patch.object(hooks, 'config_value_changed')
162 @patch.object(hooks, 'configure_https')
163- def test_config_changed_git(self, configure_https, config_val_changed):
164+ def test_config_changed_git(self, configure_https):
165 self.git_install_requested.return_value = True
166 repo = 'cloud:trusty-juno'
167 openstack_origin_git = {
168@@ -202,10 +203,25 @@
169 self.assertTrue(self.save_script_rc.called)
170 mock_filter_packages.assert_called_with([])
171
172+ @patch.object(hooks, 'filter_installed_packages')
173+ @patch.object(hooks, 'configure_https')
174+ @patch.object(hooks, 'compute_changed')
175+ def test_config_changed_region_change(self, mock_compute_changed,
176+ mock_config_https,
177+ mock_filter_packages):
178+ self.git_install_requested.return_value = False
179+ self.openstack_upgrade_available.return_value = False
180+ self.config_value_changed.return_value = True
181+ self.related_units.return_value = ['unit/0']
182+ self.relation_ids.side_effect = \
183+ lambda x: ['generic_rid'] if x == 'cloud-compute' else []
184+ hooks.config_changed()
185+ mock_compute_changed.assert_has_calls([call('generic_rid', 'unit/0')])
186+
187 def test_compute_changed_ssh_migration(self):
188 self.test_relation.set({
189 'migration_auth_type': 'ssh', 'ssh_public_key': 'fookey',
190- 'private-address': '10.0.0.1'})
191+ 'private-address': '10.0.0.1', 'region': 'RegionOne'})
192 self.ssh_known_hosts_lines.return_value = [
193 'k_h_0', 'k_h_1', 'k_h_2']
194 self.ssh_authorized_keys_lines.return_value = [
195@@ -233,7 +249,7 @@
196 def test_compute_changed_nova_public_key(self):
197 self.test_relation.set({
198 'migration_auth_type': 'sasl', 'nova_ssh_public_key': 'fookey',
199- 'private-address': '10.0.0.1'})
200+ 'private-address': '10.0.0.1', 'region': 'RegionOne'})
201 self.ssh_known_hosts_lines.return_value = [
202 'k_h_0', 'k_h_1', 'k_h_2']
203 self.ssh_authorized_keys_lines.return_value = [
204@@ -861,6 +877,7 @@
205 def test_config_changed_single_consoleauth(self, mock_config,
206 mock_configure_https,
207 mock_filter_packages):
208+ self.config_value_changed.return_value = False
209 self.git_install_requested.return_value = False
210 config.return_value = 'novnc'
211 rids = {'ha': ['ha:1']}

Subscribers

People subscribed via source and target branches