Force db_joined on action upgrade for nova-api db

On action managed upgrade db_joined was not called and the new required db,
nova-api, was not created when upgrading to mitaka.

Change-Id: Idde9655919dfb42b00f030d74c85ff09821e36ee
Closes-bug: 1611096
This commit is contained in:
David Ames 2016-08-08 14:26:33 -07:00
parent 3f4998bd06
commit 195853220d
2 changed files with 9 additions and 3 deletions

View File

@ -34,6 +34,7 @@ from nova_cc_hooks import (
config_changed,
CONFIGS,
neutron_api_relation_joined,
db_joined,
)
@ -50,6 +51,10 @@ def openstack_upgrade():
CONFIGS)):
[neutron_api_relation_joined(rid=rid, remote_restart=True)
for rid in relation_ids('neutron-api')]
# NOTE(thedac): Force re-fire of shared-db joined hook
# to ensure that nova_api database is setup if required.
[db_joined(relation_id=r_id)
for r_id in relation_ids('shared-db')]
config_changed()
if __name__ == '__main__':

View File

@ -42,6 +42,7 @@ TO_PATCH = [
'do_openstack_upgrade',
'relation_ids',
'neutron_api_relation_joined',
'db_joined',
'config_changed',
]
@ -66,9 +67,9 @@ class TestNovaCCUpgradeActions(CharmTestCase):
openstack_upgrade.openstack_upgrade()
self.assertTrue(self.do_openstack_upgrade.called)
self.assertTrue(
self.neutron_api_relation_joined.called_with(rid='relid1',
remote_restart=True))
self.neutron_api_relation_joined.assert_called_with(
rid='relid1', remote_restart=True)
self.db_joined.assert_called_with(relation_id='relid1')
self.assertTrue(self.config_changed.called)
@patch('charmhelpers.contrib.openstack.utils.config')