Merge lp:~billy-olsen/charms/trusty/nova-compute/lp1512908-backport into lp:~openstack-charmers-archive/charms/trusty/nova-compute/trunk

Proposed by Billy Olsen
Status: Merged
Merged at revision: 142
Proposed branch: lp:~billy-olsen/charms/trusty/nova-compute/lp1512908-backport
Merge into: lp:~openstack-charmers-archive/charms/trusty/nova-compute/trunk
Diff against target: 132 lines (+46/-13)
2 files modified
hooks/nova_compute_context.py (+10/-1)
unit_tests/test_nova_compute_contexts.py (+36/-12)
To merge this branch: bzr merge lp:~billy-olsen/charms/trusty/nova-compute/lp1512908-backport
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+277205@code.launchpad.net

Description of the change

This is a backport of gnuoy's change for bug #1512908

To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #13429 nova-compute for billy-olsen mp277205
    LINT OK: passed

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

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

charm_unit_test #12563 nova-compute for billy-olsen mp277205
    UNIT OK: passed

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

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

charm_amulet_test #7840 nova-compute for billy-olsen mp277205
    AMULET FAIL: amulet-test failed

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

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

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

Approved.

Ran amulet tests by hand:

juju-test INFO : Results: 10 passed, 1 failed, 0 errored

The failed one was trusty-kilo-git which seemed to be an undercloud issue which I don't think should block this.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/nova_compute_context.py'
--- hooks/nova_compute_context.py 2015-10-22 13:23:10 +0000
+++ hooks/nova_compute_context.py 2015-11-11 00:24:06 +0000
@@ -2,6 +2,7 @@
2import os2import os
3import platform3import platform
44
5from charmhelpers.core.unitdata import kv
5from charmhelpers.contrib.openstack import context6from charmhelpers.contrib.openstack import context
6from charmhelpers.core.host import service_running, service_start7from charmhelpers.core.host import service_running, service_start
7from charmhelpers.fetch import apt_install, filter_installed_packages8from charmhelpers.fetch import apt_install, filter_installed_packages
@@ -134,7 +135,15 @@
134 if config('hugepages'):135 if config('hugepages'):
135 ctxt['hugepages'] = True136 ctxt['hugepages'] = True
136137
137 ctxt['host_uuid'] = '%s' % uuid.uuid4()138 db = kv()
139 if db.get('host_uuid'):
140 ctxt['host_uuid'] = db.get('host_uuid')
141 else:
142 host_uuid = str(uuid.uuid4())
143 db.set('host_uuid', host_uuid)
144 db.flush()
145 ctxt['host_uuid'] = host_uuid
146
138 return ctxt147 return ctxt
139148
140149
141150
=== modified file 'unit_tests/test_nova_compute_contexts.py'
--- unit_tests/test_nova_compute_contexts.py 2015-10-22 13:23:10 +0000
+++ unit_tests/test_nova_compute_contexts.py 2015-11-11 00:24:06 +0000
@@ -10,6 +10,7 @@
10TO_PATCH = [10TO_PATCH = [
11 'apt_install',11 'apt_install',
12 'filter_installed_packages',12 'filter_installed_packages',
13 'kv',
13 'relation_ids',14 'relation_ids',
14 'relation_get',15 'relation_get',
15 'related_units',16 'related_units',
@@ -58,6 +59,23 @@
58 print '[juju test log (%s)] %s' % (level, msg)59 print '[juju test log (%s)] %s' % (level, msg)
5960
6061
62class FakeUnitdata(object):
63
64 def __init__(self, **kwargs):
65 self.unit_data = {}
66 for name, value in kwargs.items():
67 self.unit_data[name] = value
68
69 def get(self, key, default=None, record=False):
70 return self.unit_data.get(key)
71
72 def set(self, key, value):
73 self.unit_data[key] = value
74
75 def flush(self):
76 pass
77
78
61class NovaComputeContextTests(CharmTestCase):79class NovaComputeContextTests(CharmTestCase):
6280
63 def setUp(self):81 def setUp(self):
@@ -65,6 +83,7 @@
65 self.relation_get.side_effect = self.test_relation.get83 self.relation_get.side_effect = self.test_relation.get
66 self.config.side_effect = self.test_config.get84 self.config.side_effect = self.test_config.get
67 self.log.side_effect = fake_log85 self.log.side_effect = fake_log
86 self.host_uuid = 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'
6887
69 def test_cloud_compute_context_no_relation(self):88 def test_cloud_compute_context_no_relation(self):
70 self.relation_ids.return_value = []89 self.relation_ids.return_value = []
@@ -173,34 +192,31 @@
173 with patch.object(qplugin, '_ensure_packages'):192 with patch.object(qplugin, '_ensure_packages'):
174 self.assertEquals({}, qplugin())193 self.assertEquals({}, qplugin())
175194
176 @patch.object(context.uuid, 'uuid4')195 def test_libvirt_bin_context_no_migration(self):
177 def test_libvirt_bin_context_no_migration(self, mock_uuid):196 self.kv.return_value = FakeUnitdata(**{'host_uuid': self.host_uuid})
178 self.test_config.set('enable-live-migration', False)197 self.test_config.set('enable-live-migration', False)
179 mock_uuid.return_value = 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'
180 libvirt = context.NovaComputeLibvirtContext()198 libvirt = context.NovaComputeLibvirtContext()
181199
182 self.assertEqual(200 self.assertEqual(
183 {'libvirtd_opts': '-d',201 {'libvirtd_opts': '-d',
184 'arch': platform.machine(),202 'arch': platform.machine(),
185 'listen_tls': 0,203 'listen_tls': 0,
186 'host_uuid': 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'}, libvirt())204 'host_uuid': self.host_uuid}, libvirt())
187205
188 @patch.object(context.uuid, 'uuid4')206 def test_libvirt_bin_context_migration_tcp_listen(self):
189 def test_libvirt_bin_context_migration_tcp_listen(self, mock_uuid):207 self.kv.return_value = FakeUnitdata(**{'host_uuid': self.host_uuid})
190 self.test_config.set('enable-live-migration', True)208 self.test_config.set('enable-live-migration', True)
191 mock_uuid.return_value = 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'
192 libvirt = context.NovaComputeLibvirtContext()209 libvirt = context.NovaComputeLibvirtContext()
193210
194 self.assertEqual(211 self.assertEqual(
195 {'libvirtd_opts': '-d -l',212 {'libvirtd_opts': '-d -l',
196 'arch': platform.machine(),213 'arch': platform.machine(),
197 'listen_tls': 0,214 'listen_tls': 0,
198 'host_uuid': 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'}, libvirt())215 'host_uuid': self.host_uuid}, libvirt())
199216
200 @patch.object(context.uuid, 'uuid4')217 def test_libvirt_disk_cachemodes(self):
201 def test_libvirt_disk_cachemodes(self, mock_uuid):218 self.kv.return_value = FakeUnitdata(**{'host_uuid': self.host_uuid})
202 self.test_config.set('disk-cachemodes', 'file=unsafe,block=none')219 self.test_config.set('disk-cachemodes', 'file=unsafe,block=none')
203 mock_uuid.return_value = 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'
204 libvirt = context.NovaComputeLibvirtContext()220 libvirt = context.NovaComputeLibvirtContext()
205221
206 self.assertEqual(222 self.assertEqual(
@@ -208,7 +224,15 @@
208 'disk_cachemodes': 'file=unsafe,block=none',224 'disk_cachemodes': 'file=unsafe,block=none',
209 'arch': platform.machine(),225 'arch': platform.machine(),
210 'listen_tls': 0,226 'listen_tls': 0,
211 'host_uuid': 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'}, libvirt())227 'host_uuid': self.host_uuid}, libvirt())
228
229 @patch.object(context.uuid, 'uuid4')
230 def test_libvirt_new_uuid(self, mock_uuid):
231 self.kv.return_value = FakeUnitdata()
232 mock_uuid.return_value = '73874c1c-ba48-406d-8d99-ac185d83b9bc'
233 libvirt = context.NovaComputeLibvirtContext()
234 self.assertEqual(libvirt()['host_uuid'],
235 '73874c1c-ba48-406d-8d99-ac185d83b9bc')
212236
213 @patch.object(context.NeutronComputeContext, 'network_manager')237 @patch.object(context.NeutronComputeContext, 'network_manager')
214 @patch.object(context.NeutronComputeContext, 'plugin')238 @patch.object(context.NeutronComputeContext, 'plugin')

Subscribers

People subscribed via source and target branches