From 8d5d3a93b760f904f02dc644e7b6f60f9d0d96dd Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 29 Sep 2022 11:47:29 +0900 Subject: [PATCH] Remove logic to detect legacy network resources The legacy resources were already removed so usage of these resources should fail at stack creation. Depends-on: https://review.opendev.org/859521 Change-Id: I4210c959d303f651166a81e24db4f07c7043fca8 --- tripleoclient/tests/test_utils.py | 34 ------------------- .../overcloud_deploy/test_overcloud_deploy.py | 15 +++----- tripleoclient/utils.py | 16 --------- tripleoclient/v1/overcloud_deploy.py | 2 -- 4 files changed, 5 insertions(+), 62 deletions(-) diff --git a/tripleoclient/tests/test_utils.py b/tripleoclient/tests/test_utils.py index 1283145d9..f44e1fea1 100644 --- a/tripleoclient/tests/test_utils.py +++ b/tripleoclient/tests/test_utils.py @@ -668,18 +668,6 @@ class TestWaitForStackUtil(TestCase): result = utils.wait_for_stack_ready(self.mock_orchestration, 'stack') self.assertEqual(False, result) - def test_check_heat_network_config(self): - env_reg = { - 'OS::TripleO::Controller::Net::SoftwareConfig': 'val', - 'OS::TripleO::Compute::Net::SoftwareConfig': 'val', - } - env = { - 'resource_registry': env_reg - } - - self.assertRaises(exceptions.InvalidConfiguration, - utils.check_nic_config_with_ansible, env) - def test_check_service_vips_migrated_to_service(self): env_reg = { 'OS::TripleO::Network::Ports::RedisVipPort': 'val', @@ -693,28 +681,6 @@ class TestWaitForStackUtil(TestCase): utils.check_service_vips_migrated_to_service, env) - def test_check_heat_none_network_config(self): - env_reg = { - 'OS::TripleO::Controller::Net::SoftwareConfig': 'OS::Heat::None', - 'OS::TripleO::Compute::Net::SoftwareConfig': 'OS::Heat::None', - } - env = { - 'resource_registry': env_reg, - 'parameter_defaults': {'NetworkConfigWithAnsible': True} - } - utils.check_nic_config_with_ansible(env) - - def test_check_heat_network_config_no_ansible(self): - env_reg = { - 'OS::TripleO::Controller::Net::SoftwareConfig': 'val', - 'OS::TripleO::Compute::Net::SoftwareConfig': 'val', - } - env = { - 'resource_registry': env_reg, - 'parameter_defaults': {'NetworkConfigWithAnsible': False} - } - utils.check_nic_config_with_ansible(env) - def test_check_ceph_fsid_matches_env_files(self): stack_params = { 'CephClusterFSID': 'ceph_fsid_val', diff --git a/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py b/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py index 5404ef816..8b4eee6af 100644 --- a/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py +++ b/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py @@ -155,7 +155,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): autospec=True, return_value={}) @mock.patch('heatclient.common.template_utils.' 'process_environment_and_files', autospec=True) - @mock.patch('tripleoclient.utils.check_nic_config_with_ansible') @mock.patch('tripleoclient.utils.get_ctlplane_attrs', autospec=True, return_value={}) @mock.patch('tripleoclient.utils.copy_clouds_yaml') @@ -180,7 +179,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): mock_ceph_fsid, mock_swift_rgw, mock_ceph_ansible, mock_get_undercloud_host_entry, mock_copy, - mock_get_ctlplane_attrs, mock_nic_ansiblei, + mock_get_ctlplane_attrs, mock_process_env, mock_roles_data, mock_container_prepare, mock_generate_password, mock_rc_params, mock_default_image_params, @@ -472,7 +471,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): autospec=True, return_value={}) @mock.patch('heatclient.common.template_utils.' 'process_environment_and_files', autospec=True) - @mock.patch('tripleoclient.utils.check_nic_config_with_ansible') @mock.patch('tripleoclient.utils.copy_clouds_yaml') @mock.patch('tripleoclient.utils.get_undercloud_host_entry', autospec=True, return_value='192.168.0.1 uc.ctlplane.localhost uc.ctlplane') @@ -496,7 +494,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): mock_ceph_fsid, mock_swift_rgw, mock_ceph_ansible, mock_get_undercloud_host_entry, - mock_copy, mock_nic_ansible, + mock_copy, mock_process_env, mock_roles_data, mock_image_prepare, @@ -573,7 +571,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): @mock.patch('tripleoclient.utils.get_rc_params', autospec=True) @mock.patch('tripleoclient.utils.process_multiple_environments', autospec=True) - @mock.patch('tripleoclient.utils.check_nic_config_with_ansible') @mock.patch('tripleoclient.utils.copy_clouds_yaml') @mock.patch('tripleoclient.utils.check_ceph_fsid_matches_env_files') @mock.patch('tripleoclient.utils.check_swift_and_rgw') @@ -590,7 +587,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): mock_update_parameters, mock_post_config, mock_ceph_fsid, mock_swift_rgw, mock_ceph_ansible, - mock_copy, mock_nic_ansible, + mock_copy, mock_process_env, mock_rc_params, mock_check_service_vip_migr): fixture = deployment.DeploymentWorkflowFixture() @@ -795,7 +792,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): return_value={}) @mock.patch('tripleoclient.utils.get_roles_data', autospec=True, return_value={}) - @mock.patch('tripleoclient.utils.check_nic_config_with_ansible') @mock.patch('tripleoclient.utils.copy_clouds_yaml') @mock.patch('tripleoclient.utils.get_undercloud_host_entry', autospec=True, return_value='192.168.0.1 uc.ctlplane.localhost uc.ctlplane') @@ -811,7 +807,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): mock_ceph_fsid, mock_swift_rgw, mock_ceph_ansible, mock_get_undercloud_host_entry, - mock_copy, mock_nic_ansible, + mock_copy, mock_roles_data, mock_image_prepare, mock_generate_password, mock_rc_params, mock_check_service_vip_migr, @@ -1334,7 +1330,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): autospec=True, return_value={}) @mock.patch('tripleoclient.utils.process_multiple_environments', autospec=True) - @mock.patch('tripleoclient.utils.check_nic_config_with_ansible') @mock.patch('tripleoclient.utils.get_ctlplane_attrs', autospec=True, return_value={}) @mock.patch('tripleoclient.utils.copy_clouds_yaml') @@ -1350,7 +1345,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): self, mock_hc, mock_ceph_fsid, mock_swift_rgw, mock_ceph_ansible, mock_hd, mock_get_undercloud_host_entry, mock_copy, - mock_get_ctlplane_attrs, mock_nic_ansible, + mock_get_ctlplane_attrs, mock_process_env, mock_roles_data, mock_container_prepare, mock_generate_password, mock_rc_params, mock_default_image_params, diff --git a/tripleoclient/utils.py b/tripleoclient/utils.py index 3b34ae8f5..2d69f4fc5 100644 --- a/tripleoclient/utils.py +++ b/tripleoclient/utils.py @@ -1233,22 +1233,6 @@ def check_network_plugin(output_dir, env): raise exceptions.InvalidConfiguration(message) -def check_nic_config_with_ansible(environment): - registry = environment.get('resource_registry', {}) - is_ansible_config = environment.get( - 'parameter_defaults', {}).get( - 'NetworkConfigWithAnsible', True) - if is_ansible_config: - for k, v in registry.items(): - if k.endswith('Net::SoftwareConfig'): - if v != 'OS::Heat::None': - raise exceptions.InvalidConfiguration( - "DEPRECATED: Old heat nic configs are used, " - "Migrate to ansible jinja templates or use " - "'NetworkConfigWithAnsible: false' " - "in 'parameter_defaults'.") - - def check_service_vips_migrated_to_service(environment): registry = environment.get('resource_registry', {}) removed_resources = {'OS::TripleO::Network::Ports::RedisVipPort', diff --git a/tripleoclient/v1/overcloud_deploy.py b/tripleoclient/v1/overcloud_deploy.py index 432b1a5a3..4d27caee0 100644 --- a/tripleoclient/v1/overcloud_deploy.py +++ b/tripleoclient/v1/overcloud_deploy.py @@ -358,8 +358,6 @@ class DeployOvercloud(command.Command): # upgrades: check if swift is deployed utils.check_swift_and_rgw(old_stack_env, env, self.__class__.__name__) - # check migration to new nic config with ansible - utils.check_nic_config_with_ansible(env) # check migration to service vips managed by servce utils.check_service_vips_migrated_to_service(env)