Merge lp:~gnuoy/charms/trusty/nova-cloud-controller/restict-neutron-db-migrations into lp:~openstack-charmers-archive/charms/trusty/nova-cloud-controller/next

Proposed by Liam Young
Status: Merged
Merged at revision: 104
Proposed branch: lp:~gnuoy/charms/trusty/nova-cloud-controller/restict-neutron-db-migrations
Merge into: lp:~openstack-charmers-archive/charms/trusty/nova-cloud-controller/next
Diff against target: 55 lines (+18/-3)
2 files modified
hooks/nova_cc_hooks.py (+4/-0)
unit_tests/test_nova_cc_hooks.py (+14/-3)
To merge this branch: bzr merge lp:~gnuoy/charms/trusty/nova-cloud-controller/restict-neutron-db-migrations
Reviewer Review Type Date Requested Status
James Page Approve
Review via email: mp+236670@code.launchpad.net
To post a comment you must log in.
Revision history for this message
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/nova_cc_hooks.py'
2--- hooks/nova_cc_hooks.py 2014-09-29 13:58:29 +0000
3+++ hooks/nova_cc_hooks.py 2014-10-01 08:33:10 +0000
4@@ -40,6 +40,7 @@
5 from charmhelpers.contrib.openstack.utils import (
6 configure_installation_source,
7 openstack_upgrade_available,
8+ os_release,
9 )
10
11 from charmhelpers.contrib.openstack.neutron import (
12@@ -179,6 +180,9 @@
13 if relation_ids('neutron-api'):
14 log('Not running neutron database migration as neutron-api service'
15 'is present.')
16+ elif os_release('nova-common') <= 'icehouse':
17+ log('Not running neutron database migration as migrations are handled'
18+ 'by the neutron-server process.')
19 else:
20 migrate_neutron_database()
21 # neutron-api service may have appeared while the migration was
22
23=== modified file 'unit_tests/test_nova_cc_hooks.py'
24--- unit_tests/test_nova_cc_hooks.py 2014-09-29 13:58:29 +0000
25+++ unit_tests/test_nova_cc_hooks.py 2014-10-01 08:33:10 +0000
26@@ -39,6 +39,7 @@
27 'is_relation_made',
28 'local_unit',
29 'log',
30+ 'os_release',
31 'relation_get',
32 'relation_set',
33 'relation_ids',
34@@ -508,8 +509,18 @@
35 )
36
37 def test_conditional_neutron_migration_noapi_rel(self):
38+ self.os_release.return_value = 'juno'
39 self.relation_ids.return_value = []
40- hooks.conditional_neutron_migration()
41 self.services.return_value = ['neutron-server']
42- self.migrate_neutron_database.assert_called()
43- self.service_restart.assert_called()
44+ hooks.conditional_neutron_migration()
45+ self.migrate_neutron_database.assert_called_with()
46+ self.service_restart.assert_called_with('neutron-server')
47+
48+ def test_conditional_neutron_migration_noapi_rel_juno(self):
49+ self.os_release.return_value = 'icehouse'
50+ self.relation_ids.return_value = []
51+ hooks.conditional_neutron_migration()
52+ self.log.assert_called_with(
53+ 'Not running neutron database migration as migrations are handled'
54+ 'by the neutron-server process.'
55+ )

Subscribers

People subscribed via source and target branches