Merge lp:~gnuoy/charms/trusty/nova-compute/1512908 into lp:~openstack-charmers-archive/charms/trusty/nova-compute/next

Proposed by Liam Young on 2015-11-10
Status: Merged
Merged at revision: 181
Proposed branch: lp:~gnuoy/charms/trusty/nova-compute/1512908
Merge into: lp:~openstack-charmers-archive/charms/trusty/nova-compute/next
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:~gnuoy/charms/trusty/nova-compute/1512908
Reviewer Review Type Date Requested Status
Billy Olsen 2015-11-10 Approve on 2015-11-10
Review via email: mp+277124@code.launchpad.net
To post a comment you must log in.

charm_lint_check #13423 nova-compute-next for gnuoy mp277124
    LINT OK: passed

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

charm_unit_test #12557 nova-compute-next for gnuoy mp277124
    UNIT OK: passed

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

charm_amulet_test #7832 nova-compute-next for gnuoy mp277124
    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/13216182/
Build: http://10.245.162.77:8080/job/charm_amulet_test/7832/

182. By Liam Young on 2015-11-10

Empty commit to tickle osci

charm_lint_check #13426 nova-compute-next for gnuoy mp277124
    LINT OK: passed

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

charm_unit_test #12560 nova-compute-next for gnuoy mp277124
    UNIT OK: passed

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

charm_amulet_test #7834 nova-compute-next for gnuoy mp277124
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
Timeout occurred (2700s), printing juju status...environment: osci-sv05
ERROR:root:Make target returned non-zero.

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

charm_amulet_test #7835 nova-compute-next for gnuoy mp277124
    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/13217969/
Build: http://10.245.162.77:8080/job/charm_amulet_test/7835/

Ryan Beisner (1chb1n) wrote :

Undercloud woes in the preceding amulet test failures (http://paste.ubuntu.com/13218423/).

Re-kicking the test...

Billy Olsen (billy-olsen) wrote :

Looks good to me - waiting on the OSCI results for final push.

charm_amulet_test #7836 nova-compute-next for gnuoy mp277124
    AMULET OK: passed

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

Billy Olsen (billy-olsen) wrote :

Amulet passed!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/nova_compute_context.py'
2--- hooks/nova_compute_context.py 2015-10-23 09:13:01 +0000
3+++ hooks/nova_compute_context.py 2015-11-10 17:35:16 +0000
4@@ -2,6 +2,7 @@
5 import os
6 import platform
7
8+from charmhelpers.core.unitdata import kv
9 from charmhelpers.contrib.openstack import context
10 from charmhelpers.core.host import service_running, service_start
11 from charmhelpers.fetch import apt_install, filter_installed_packages
12@@ -134,7 +135,15 @@
13 if config('hugepages'):
14 ctxt['hugepages'] = True
15
16- ctxt['host_uuid'] = '%s' % uuid.uuid4()
17+ db = kv()
18+ if db.get('host_uuid'):
19+ ctxt['host_uuid'] = db.get('host_uuid')
20+ else:
21+ host_uuid = str(uuid.uuid4())
22+ db.set('host_uuid', host_uuid)
23+ db.flush()
24+ ctxt['host_uuid'] = host_uuid
25+
26 return ctxt
27
28
29
30=== modified file 'unit_tests/test_nova_compute_contexts.py'
31--- unit_tests/test_nova_compute_contexts.py 2015-09-28 17:33:02 +0000
32+++ unit_tests/test_nova_compute_contexts.py 2015-11-10 17:35:16 +0000
33@@ -10,6 +10,7 @@
34 TO_PATCH = [
35 'apt_install',
36 'filter_installed_packages',
37+ 'kv',
38 'relation_ids',
39 'relation_get',
40 'related_units',
41@@ -58,6 +59,23 @@
42 print '[juju test log (%s)] %s' % (level, msg)
43
44
45+class FakeUnitdata(object):
46+
47+ def __init__(self, **kwargs):
48+ self.unit_data = {}
49+ for name, value in kwargs.items():
50+ self.unit_data[name] = value
51+
52+ def get(self, key, default=None, record=False):
53+ return self.unit_data.get(key)
54+
55+ def set(self, key, value):
56+ self.unit_data[key] = value
57+
58+ def flush(self):
59+ pass
60+
61+
62 class NovaComputeContextTests(CharmTestCase):
63
64 def setUp(self):
65@@ -65,6 +83,7 @@
66 self.relation_get.side_effect = self.test_relation.get
67 self.config.side_effect = self.test_config.get
68 self.log.side_effect = fake_log
69+ self.host_uuid = 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'
70
71 def test_cloud_compute_context_no_relation(self):
72 self.relation_ids.return_value = []
73@@ -173,34 +192,31 @@
74 with patch.object(qplugin, '_ensure_packages'):
75 self.assertEquals({}, qplugin())
76
77- @patch.object(context.uuid, 'uuid4')
78- def test_libvirt_bin_context_no_migration(self, mock_uuid):
79+ def test_libvirt_bin_context_no_migration(self):
80+ self.kv.return_value = FakeUnitdata(**{'host_uuid': self.host_uuid})
81 self.test_config.set('enable-live-migration', False)
82- mock_uuid.return_value = 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'
83 libvirt = context.NovaComputeLibvirtContext()
84
85 self.assertEqual(
86 {'libvirtd_opts': '-d',
87 'arch': platform.machine(),
88 'listen_tls': 0,
89- 'host_uuid': 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'}, libvirt())
90+ 'host_uuid': self.host_uuid}, libvirt())
91
92- @patch.object(context.uuid, 'uuid4')
93- def test_libvirt_bin_context_migration_tcp_listen(self, mock_uuid):
94+ def test_libvirt_bin_context_migration_tcp_listen(self):
95+ self.kv.return_value = FakeUnitdata(**{'host_uuid': self.host_uuid})
96 self.test_config.set('enable-live-migration', True)
97- mock_uuid.return_value = 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'
98 libvirt = context.NovaComputeLibvirtContext()
99
100 self.assertEqual(
101 {'libvirtd_opts': '-d -l',
102 'arch': platform.machine(),
103 'listen_tls': 0,
104- 'host_uuid': 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'}, libvirt())
105+ 'host_uuid': self.host_uuid}, libvirt())
106
107- @patch.object(context.uuid, 'uuid4')
108- def test_libvirt_disk_cachemodes(self, mock_uuid):
109+ def test_libvirt_disk_cachemodes(self):
110+ self.kv.return_value = FakeUnitdata(**{'host_uuid': self.host_uuid})
111 self.test_config.set('disk-cachemodes', 'file=unsafe,block=none')
112- mock_uuid.return_value = 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'
113 libvirt = context.NovaComputeLibvirtContext()
114
115 self.assertEqual(
116@@ -208,7 +224,15 @@
117 'disk_cachemodes': 'file=unsafe,block=none',
118 'arch': platform.machine(),
119 'listen_tls': 0,
120- 'host_uuid': 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'}, libvirt())
121+ 'host_uuid': self.host_uuid}, libvirt())
122+
123+ @patch.object(context.uuid, 'uuid4')
124+ def test_libvirt_new_uuid(self, mock_uuid):
125+ self.kv.return_value = FakeUnitdata()
126+ mock_uuid.return_value = '73874c1c-ba48-406d-8d99-ac185d83b9bc'
127+ libvirt = context.NovaComputeLibvirtContext()
128+ self.assertEqual(libvirt()['host_uuid'],
129+ '73874c1c-ba48-406d-8d99-ac185d83b9bc')
130
131 @patch.object(context.NeutronComputeContext, 'network_manager')
132 @patch.object(context.NeutronComputeContext, 'plugin')

Subscribers

People subscribed via source and target branches