Remove nova-cert service during FFU

As nova-cert service doesn't exist on fresh queens
deployment, but it is enabled in newton.
During FFU from newton to queens, it is shown in
nova service list in ocata, pike and queens as well.

And since ocata and pike are EOL, we need to remove
it in queens during FFU from undercloud.

Change-Id: I1da2599ae6b0c5e860ce3a71fe6359ec649e8958
This commit is contained in:
Rajesh Tailor 2019-10-24 17:11:21 +05:30
parent 70c4c33cf7
commit 86b55944cc
2 changed files with 21 additions and 3 deletions

View File

@ -946,13 +946,15 @@ class TestPostConfig(BaseTestCase):
@mock.patch('instack_undercloud.undercloud._delete_default_flavors') @mock.patch('instack_undercloud.undercloud._delete_default_flavors')
@mock.patch('instack_undercloud.undercloud._copy_stackrc') @mock.patch('instack_undercloud.undercloud._copy_stackrc')
@mock.patch('instack_undercloud.undercloud._get_auth_values') @mock.patch('instack_undercloud.undercloud._get_auth_values')
@mock.patch('instack_undercloud.undercloud._delete_nova_cert_service')
@mock.patch('instack_undercloud.undercloud._configure_ssh_keys') @mock.patch('instack_undercloud.undercloud._configure_ssh_keys')
@mock.patch('instack_undercloud.undercloud._ensure_flavor') @mock.patch('instack_undercloud.undercloud._ensure_flavor')
@mock.patch('instack_undercloud.undercloud._post_config_mistral') @mock.patch('instack_undercloud.undercloud._post_config_mistral')
def test_post_config(self, mock_post_config_mistral, mock_ensure_flavor, def test_post_config(self, mock_post_config_mistral, mock_ensure_flavor,
mock_configure_ssh_keys, mock_get_auth_values, mock_configure_ssh_keys, mock_delete_nova_cert,
mock_copy_stackrc, mock_delete, mock_mistral_client, mock_get_auth_values, mock_copy_stackrc,
mock_swift_client, mock_nova_client, mock_ir_client, mock_delete, mock_mistral_client, mock_swift_client,
mock_nova_client, mock_ir_client,
mock_get_session, mock_member_role_exists, mock_get_session, mock_member_role_exists,
mock_ensure_neutron_network, mock_ensure_neutron_network,
mock_config_neutron_segments_and_subnets, mock_config_neutron_segments_and_subnets,
@ -987,6 +989,7 @@ class TestPostConfig(BaseTestCase):
2, session=mock_get_session.return_value) 2, session=mock_get_session.return_value)
self.assertTrue(mock_copy_stackrc.called) self.assertTrue(mock_copy_stackrc.called)
mock_configure_ssh_keys.assert_called_with(mock_instance_nova) mock_configure_ssh_keys.assert_called_with(mock_instance_nova)
mock_delete_nova_cert.assert_called_with(mock_instance_nova)
calls = [mock.call(mock_instance_nova, flavors[0], 'baremetal', None), calls = [mock.call(mock_instance_nova, flavors[0], 'baremetal', None),
mock.call(mock_instance_nova, None, 'control', 'control'), mock.call(mock_instance_nova, None, 'control', 'control'),
mock.call(mock_instance_nova, None, 'compute', 'compute'), mock.call(mock_instance_nova, None, 'compute', 'compute'),

View File

@ -2091,6 +2091,20 @@ def _migrate_to_convergence(heat):
LOG.info('Finished migrating stack "%s"', stack.id) LOG.info('Finished migrating stack "%s"', stack.id)
def _delete_nova_cert_service(nova):
"""Delete nova-cert service."""
try:
undercloud_host = CONF.undercloud_hostname or socket.gethostname()
nova.services.disable(undercloud_host, 'nova-cert')
service_list = nova.services.list()
for service in service_list:
if service.binary == 'nova-cert':
nova_cert_id = service.id
nova.services.delete(nova_cert_id)
except Exception:
LOG.debug('Continuing as nova-cert service is already deleted.')
def _post_config(instack_env, upgrade): def _post_config(instack_env, upgrade):
_copy_stackrc() _copy_stackrc()
user, password, project, auth_url = _get_auth_values() user, password, project, auth_url = _get_auth_values()
@ -2113,6 +2127,7 @@ def _post_config(instack_env, upgrade):
_configure_ssh_keys(nova) _configure_ssh_keys(nova)
_ensure_ssh_selinux_permission() _ensure_ssh_selinux_permission()
_delete_default_flavors(nova) _delete_default_flavors(nova)
_delete_nova_cert_service(nova)
_ensure_node_resource_classes(ironic) _ensure_node_resource_classes(ironic)