diff --git a/hooks/cinder_hooks.py b/hooks/cinder_hooks.py index 476f820a..7e3f230d 100755 --- a/hooks/cinder_hooks.py +++ b/hooks/cinder_hooks.py @@ -222,6 +222,13 @@ def config_changed(): cluster_joined(relation_id=rid) for r_id in relation_ids('ha'): ha_joined(relation_id=r_id) + # NOTE(jamespage): + # ensure any new volume endpoints are created. Note that this + # is normally done after an openstack series upgrade, but this + # was not performed historically so always execute to ensure + # any upgrades where this step was missed are fixed. + for rid in relation_ids('identity-service'): + identity_joined(rid=rid) @hooks.hook('shared-db-relation-joined') diff --git a/unit_tests/test_cinder_hooks.py b/unit_tests/test_cinder_hooks.py index 47a5ccab..8331de3f 100644 --- a/unit_tests/test_cinder_hooks.py +++ b/unit_tests/test_cinder_hooks.py @@ -117,6 +117,10 @@ class TestInstallHook(CharmTestCase): class TestChangedHooks(CharmTestCase): + _relations = { + 'identity-service': ['identity-service:1'], + } + def setUp(self): super(TestChangedHooks, self).setUp(hooks, TO_PATCH) self.config.side_effect = self.test_config.get @@ -149,12 +153,16 @@ class TestChangedHooks(CharmTestCase): _joined.assert_called_with(relation_id='amqp:1') _scrub_old_style_ceph.assert_called_once_with() + @patch.object(hooks, 'identity_joined') @patch.object(hooks, 'configure_https') @patch.object(hooks, 'config_value_changed') def test_config_changed(self, config_val_changed, - conf_https): + conf_https, identity_joined): 'It writes out all config' self.openstack_upgrade_available.return_value = False + self.relation_ids.side_effect = ( + lambda rname: self._relations.get(rname, []) + ) hooks.hooks.execute(['hooks/config-changed']) self.assertTrue(self.CONFIGS.write_all.called) self.assertTrue(conf_https.called) @@ -162,6 +170,7 @@ class TestChangedHooks(CharmTestCase): 'cinder-volumes', False, False, False) self.open_port.assert_called_with(8776) + identity_joined.assert_called_once_with(rid='identity-service:1') @patch.object(hooks, 'configure_https') @patch.object(hooks, 'config_value_changed')