From 195853220d98b2b10e02621e9ac143bf9a45618f Mon Sep 17 00:00:00 2001 From: David Ames Date: Mon, 8 Aug 2016 14:26:33 -0700 Subject: [PATCH] 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 --- actions/openstack_upgrade.py | 5 +++++ unit_tests/test_actions_openstack_upgrade.py | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/actions/openstack_upgrade.py b/actions/openstack_upgrade.py index 80205e88..694155e9 100755 --- a/actions/openstack_upgrade.py +++ b/actions/openstack_upgrade.py @@ -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__': diff --git a/unit_tests/test_actions_openstack_upgrade.py b/unit_tests/test_actions_openstack_upgrade.py index 775ed47e..f66fe000 100644 --- a/unit_tests/test_actions_openstack_upgrade.py +++ b/unit_tests/test_actions_openstack_upgrade.py @@ -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')