Remove the nova-api handling functions
The nova-api (commit 962790239b
)
introduced a 'nova-api' ready relation, but it was never added to the
metadata.yaml and it has never been used. This commit removes it, as
there is no need for it after 3 years, and it therefore has a
maintenance burden, even if not being used.
Change-Id: I6b13e2639b808fd640a6f8d892d1e3dd58215361
This commit is contained in:
parent
a51efaf640
commit
a0edc83109
|
@ -315,9 +315,6 @@ def amqp_changed():
|
|||
# db relation-changed hooks.
|
||||
update_cell_db_if_ready_allowed_units()
|
||||
|
||||
for r_id in hookenv.relation_ids('nova-api'):
|
||||
nova_api_relation_joined(rid=r_id)
|
||||
|
||||
update_child_cell_records()
|
||||
|
||||
# NOTE: trigger restart on nova-api-metadata on
|
||||
|
@ -412,9 +409,6 @@ def image_service_changed():
|
|||
CONFIGS.write(ncc_utils.NOVA_CONF)
|
||||
# TODO: special case config flag for essex (strip protocol)
|
||||
|
||||
for r_id in hookenv.relation_ids('nova-api'):
|
||||
nova_api_relation_joined(rid=r_id)
|
||||
|
||||
|
||||
@hooks.hook('identity-service-relation-joined')
|
||||
def identity_joined(rid=None):
|
||||
|
@ -448,9 +442,6 @@ def identity_changed():
|
|||
neutron_api_relation_joined(rid)
|
||||
configure_https()
|
||||
|
||||
for r_id in hookenv.relation_ids('nova-api'):
|
||||
nova_api_relation_joined(rid=r_id)
|
||||
|
||||
|
||||
@hooks.hook('nova-volume-service-relation-joined',
|
||||
'cinder-volume-service-relation-joined')
|
||||
|
@ -624,9 +615,6 @@ def compute_joined(rid=None, remote_restart=False):
|
|||
|
||||
@hooks.hook('cloud-compute-relation-changed')
|
||||
def compute_changed(rid=None, unit=None):
|
||||
for r_id in hookenv.relation_ids('nova-api'):
|
||||
nova_api_relation_joined(rid=r_id)
|
||||
|
||||
rel_settings = hookenv.relation_get(rid=rid, unit=unit)
|
||||
if not rel_settings.get('region', None) == hookenv.config('region'):
|
||||
hookenv.relation_set(relation_id=rid, region=hookenv.config('region'))
|
||||
|
@ -988,13 +976,6 @@ def zeromq_configuration_relation_changed():
|
|||
CONFIGS.write(ncc_utils.NOVA_CONF)
|
||||
|
||||
|
||||
def nova_api_relation_joined(rid=None):
|
||||
rel_data = {
|
||||
'nova-api-ready': 'yes' if ncc_utils.is_api_ready(CONFIGS) else 'no'
|
||||
}
|
||||
hookenv.relation_set(rid, **rel_data)
|
||||
|
||||
|
||||
@hooks.hook('certificates-relation-joined')
|
||||
def certs_joined(relation_id=None):
|
||||
hookenv.relation_set(
|
||||
|
|
|
@ -1392,11 +1392,6 @@ def check_optional_relations(configs):
|
|||
return "unknown", ""
|
||||
|
||||
|
||||
def is_api_ready(configs):
|
||||
return (not ch_utils.incomplete_relation_data(configs,
|
||||
REQUIRED_INTERFACES))
|
||||
|
||||
|
||||
def assess_status(configs):
|
||||
"""Assess status of current unit
|
||||
Decides what the state of the unit should be based on the current
|
||||
|
|
|
@ -343,18 +343,6 @@ class NovaCCHooksTests(CharmTestCase):
|
|||
[call(rid='generic_rid', remote_restart=False)])
|
||||
self.assertTrue(mock_update_aws_compat_services.called)
|
||||
|
||||
@patch('hooks.nova_cc_utils.is_cellv2_init_ready')
|
||||
@patch('hooks.nova_cc_utils.is_db_initialised')
|
||||
@patch.object(hooks, 'nova_api_relation_joined')
|
||||
def test_compute_changed_nova_api_trigger(self, api_joined,
|
||||
mock_is_db_initialised,
|
||||
mock_is_cellv2_init_ready):
|
||||
self.relation_ids.return_value = ['nova-api/0']
|
||||
mock_is_db_initialised.return_value = False
|
||||
mock_is_cellv2_init_ready.return_value = False
|
||||
hooks.compute_changed()
|
||||
api_joined.assert_called_with(rid='nova-api/0')
|
||||
|
||||
@patch('hooks.nova_cc_utils.is_cellv2_init_ready')
|
||||
@patch('hooks.nova_cc_utils.is_db_initialised')
|
||||
def test_compute_changed_ssh_migration(self, mock_is_db_initialised,
|
||||
|
@ -623,12 +611,10 @@ class NovaCCHooksTests(CharmTestCase):
|
|||
hooks.db_changed()
|
||||
|
||||
@patch.object(utils, 'resource_map')
|
||||
@patch.object(hooks, 'nova_api_relation_joined')
|
||||
@patch('hooks.nova_cc_utils.is_db_initialised')
|
||||
@patch.object(hooks, 'CONFIGS')
|
||||
def test_db_changed(self, configs,
|
||||
mock_is_db_initialised, api_joined, mock_resource_map):
|
||||
self.relation_ids.return_value = ['nova-api/0']
|
||||
mock_is_db_initialised, mock_resource_map):
|
||||
mock_is_db_initialised.return_value = False
|
||||
mock_resource_map.return_value = {}
|
||||
'No database migration is attempted when ACL list is not present'
|
||||
|
@ -636,7 +622,6 @@ class NovaCCHooksTests(CharmTestCase):
|
|||
self._shared_db_test(configs)
|
||||
self.assertTrue(configs.write_all.called)
|
||||
self.assertFalse(self.migrate_nova_databases.called)
|
||||
api_joined.asert_called_with(rid='nova-api/0')
|
||||
|
||||
@patch.object(utils, 'resource_map')
|
||||
@patch('hooks.nova_cc_utils.is_db_initialised')
|
||||
|
@ -721,16 +706,14 @@ class NovaCCHooksTests(CharmTestCase):
|
|||
@patch.object(hooks, 'update_cell_db_if_ready_allowed_units')
|
||||
@patch('hooks.nova_cc_utils.is_db_initialised')
|
||||
@patch.object(hooks, 'quantum_joined')
|
||||
@patch.object(hooks, 'nova_api_relation_joined')
|
||||
@patch.object(hooks, 'CONFIGS')
|
||||
def test_amqp_changed_api_rel(self, configs, api_joined,
|
||||
def test_amqp_changed_api_rel(self, configs,
|
||||
quantum_joined, mock_is_db_initialised,
|
||||
update_db_allowed, init_db_allowed,
|
||||
mock_resource_map,
|
||||
mock_update_child_cell_records):
|
||||
mock_resource_map.return_value = {}
|
||||
self.relation_ids.side_effect = [
|
||||
['nova-api/0'],
|
||||
['quantum-service/0'],
|
||||
]
|
||||
mock_is_db_initialised.return_value = False
|
||||
|
@ -742,7 +725,6 @@ class NovaCCHooksTests(CharmTestCase):
|
|||
hooks.amqp_changed()
|
||||
self.assertEqual(configs.write.call_args_list,
|
||||
[call('/etc/nova/nova.conf')])
|
||||
api_joined.assert_called_with(rid='nova-api/0')
|
||||
quantum_joined.assert_called_with(rid='quantum-service/0',
|
||||
remote_restart=True)
|
||||
|
||||
|
@ -752,11 +734,9 @@ class NovaCCHooksTests(CharmTestCase):
|
|||
@patch.object(utils, 'resource_map')
|
||||
@patch('hooks.nova_cc_utils.is_db_initialised')
|
||||
@patch.object(hooks, 'quantum_joined')
|
||||
@patch.object(hooks, 'nova_api_relation_joined')
|
||||
@patch.object(hooks, 'CONFIGS')
|
||||
def test_amqp_changed_noapi_rel(self,
|
||||
configs,
|
||||
api_joined,
|
||||
quantum_joined,
|
||||
mock_is_db_initialised,
|
||||
mock_resource_map,
|
||||
|
@ -769,7 +749,6 @@ class NovaCCHooksTests(CharmTestCase):
|
|||
configs.complete_contexts.return_value = ['amqp']
|
||||
configs.write = MagicMock()
|
||||
self.relation_ids.side_effect = [
|
||||
['nova-api/0'],
|
||||
['quantum-service/0'],
|
||||
]
|
||||
self.is_relation_made.return_value = False
|
||||
|
@ -778,7 +757,6 @@ class NovaCCHooksTests(CharmTestCase):
|
|||
hooks.amqp_changed()
|
||||
self.assertEqual(configs.write.call_args_list,
|
||||
[call('/etc/nova/nova.conf')])
|
||||
api_joined.assert_called_with(rid='nova-api/0')
|
||||
quantum_joined.assert_called_with(rid='quantum-service/0',
|
||||
remote_restart=True)
|
||||
|
||||
|
@ -959,20 +937,6 @@ class NovaCCHooksTests(CharmTestCase):
|
|||
ha='settings',
|
||||
relation_id=None)
|
||||
|
||||
@patch('hooks.nova_cc_utils.is_api_ready')
|
||||
def helper_test_nova_api_relation_joined(self, tgt, is_api_ready):
|
||||
is_api_ready.return_value = tgt
|
||||
exp = 'yes' if tgt else 'no'
|
||||
hooks.nova_api_relation_joined(rid='foo')
|
||||
self.relation_set.assert_called_with(
|
||||
'foo', **{'nova-api-ready': exp})
|
||||
|
||||
def test_nova_api_relation_joined_ready(self):
|
||||
self.helper_test_nova_api_relation_joined(True)
|
||||
|
||||
def test_nova_api_relation_joined_not_ready(self):
|
||||
self.helper_test_nova_api_relation_joined(False)
|
||||
|
||||
@patch.object(hooks, 'memcached_common')
|
||||
def test_memcache_joined(self, _memcached_common):
|
||||
self.get_relation_ip.return_value = 'foo'
|
||||
|
|
|
@ -1194,21 +1194,6 @@ class NovaCCUtilsTests(CharmTestCase):
|
|||
self.assertFalse(self.service_running.called)
|
||||
self.assertFalse(_mc.called)
|
||||
|
||||
def helper_test_is_api_ready(self, tgt):
|
||||
fake_config = MagicMock()
|
||||
with patch('charmhelpers.contrib.openstack.utils.'
|
||||
'incomplete_relation_data') as ird:
|
||||
ird.return_value = (not tgt)
|
||||
self.assertEqual(utils.is_api_ready(fake_config), tgt)
|
||||
ird.assert_called_with(
|
||||
fake_config, utils.REQUIRED_INTERFACES)
|
||||
|
||||
def test_is_api_ready_true(self):
|
||||
self.helper_test_is_api_ready(True)
|
||||
|
||||
def test_is_api_ready_false(self):
|
||||
self.helper_test_is_api_ready(False)
|
||||
|
||||
def test_assess_status(self):
|
||||
with patch.object(utils, 'assess_status_func') as asf:
|
||||
configs = MagicMock()
|
||||
|
|
Loading…
Reference in New Issue