Don't allow Redis/OvnDBs VIP in resource_registry
In the depends-on change the Redis and OvnDBs VIP is refactored to the respective service templates. This adds a validation to raise a ConfigurationError in case the resource registry contains the deprecated resoirce definitions: OS::TripleO::Network::Ports::RedisVipPort OS::TripleO::Network::Ports::OVNDBsVipPort Depends-On: https://review.opendev.org/777259 Change-Id: Id5415a94f71cbed5fad9856fd68e109979ffd491
This commit is contained in:
parent
a161e88fa7
commit
8c90a0c70a
|
@ -466,6 +466,28 @@ class TestWaitForStackUtil(TestCase):
|
||||||
utils.check_nic_config_with_ansible,
|
utils.check_nic_config_with_ansible,
|
||||||
mock_stack, env)
|
mock_stack, env)
|
||||||
|
|
||||||
|
def test_check_service_vips_migrated_to_service(self):
|
||||||
|
stack_reg = {
|
||||||
|
'OS::TripleO::Network::Ports::RedisVipPort': 'val',
|
||||||
|
'OS::TripleO::Network::Ports::OVNDBsVipPort': 'val',
|
||||||
|
}
|
||||||
|
env_reg = {
|
||||||
|
'OS::TripleO::Network::Ports::RedisVipPort': 'val',
|
||||||
|
'OS::TripleO::Network::Ports::OVNDBsVipPort': 'val',
|
||||||
|
}
|
||||||
|
mock_stack = mock.MagicMock()
|
||||||
|
mock_stack.environment = mock.MagicMock()
|
||||||
|
mock_stack.environment.return_value = {
|
||||||
|
'resource_registry': stack_reg,
|
||||||
|
}
|
||||||
|
env = {
|
||||||
|
'resource_registry': env_reg
|
||||||
|
}
|
||||||
|
|
||||||
|
self.assertRaises(exceptions.InvalidConfiguration,
|
||||||
|
utils.check_service_vips_migrated_to_service,
|
||||||
|
mock_stack, env)
|
||||||
|
|
||||||
def test_check_heat_missing_network_config(self):
|
def test_check_heat_missing_network_config(self):
|
||||||
stack_reg = {
|
stack_reg = {
|
||||||
'OS::TripleO::Controller::Net::SoftwareConfig': 'val',
|
'OS::TripleO::Controller::Net::SoftwareConfig': 'val',
|
||||||
|
|
|
@ -111,6 +111,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||||
os.unlink(self.parameter_defaults_env_file)
|
os.unlink(self.parameter_defaults_env_file)
|
||||||
shutil.rmtree = self.real_shutil
|
shutil.rmtree = self.real_shutil
|
||||||
|
|
||||||
|
@mock.patch('tripleoclient.utils.check_service_vips_migrated_to_service')
|
||||||
@mock.patch('tripleoclient.utils.build_stack_data', autospec=True)
|
@mock.patch('tripleoclient.utils.build_stack_data', autospec=True)
|
||||||
@mock.patch('tripleo_common.utils.plan.default_image_params',
|
@mock.patch('tripleo_common.utils.plan.default_image_params',
|
||||||
autospec=True)
|
autospec=True)
|
||||||
|
@ -153,7 +154,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||||
mock_process_env, mock_roles_data,
|
mock_process_env, mock_roles_data,
|
||||||
mock_container_prepare, mock_generate_password,
|
mock_container_prepare, mock_generate_password,
|
||||||
mock_rc_params, mock_default_image_params,
|
mock_rc_params, mock_default_image_params,
|
||||||
mock_stack_data):
|
mock_stack_data, mock_check_service_vip_migr):
|
||||||
fixture = deployment.DeploymentWorkflowFixture()
|
fixture = deployment.DeploymentWorkflowFixture()
|
||||||
self.useFixture(fixture)
|
self.useFixture(fixture)
|
||||||
clients = self.app.client_manager
|
clients = self.app.client_manager
|
||||||
|
@ -414,6 +415,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||||
self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
mock_copy.assert_called_once()
|
mock_copy.assert_called_once()
|
||||||
|
|
||||||
|
@mock.patch('tripleoclient.utils.check_service_vips_migrated_to_service')
|
||||||
@mock.patch('tripleoclient.utils.build_stack_data', autospec=True)
|
@mock.patch('tripleoclient.utils.build_stack_data', autospec=True)
|
||||||
@mock.patch('tripleoclient.utils.get_rc_params', autospec=True)
|
@mock.patch('tripleoclient.utils.get_rc_params', autospec=True)
|
||||||
@mock.patch('tripleo_common.utils.plan.generate_passwords',
|
@mock.patch('tripleo_common.utils.plan.generate_passwords',
|
||||||
|
@ -454,7 +456,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||||
mock_image_prepare,
|
mock_image_prepare,
|
||||||
mock_generate_password,
|
mock_generate_password,
|
||||||
mock_rc_params,
|
mock_rc_params,
|
||||||
mock_stack_data):
|
mock_stack_data,
|
||||||
|
mock_check_service_vip_migr):
|
||||||
fixture = deployment.DeploymentWorkflowFixture()
|
fixture = deployment.DeploymentWorkflowFixture()
|
||||||
self.useFixture(fixture)
|
self.useFixture(fixture)
|
||||||
utils_fixture = deployment.UtilsFixture()
|
utils_fixture = deployment.UtilsFixture()
|
||||||
|
@ -518,6 +521,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||||
self.cmd.take_action, parsed_args)
|
self.cmd.take_action, parsed_args)
|
||||||
self.assertFalse(mock_deploy_tht.called)
|
self.assertFalse(mock_deploy_tht.called)
|
||||||
|
|
||||||
|
@mock.patch('tripleoclient.utils.check_service_vips_migrated_to_service')
|
||||||
@mock.patch('tripleoclient.utils.get_rc_params', autospec=True)
|
@mock.patch('tripleoclient.utils.get_rc_params', autospec=True)
|
||||||
@mock.patch('heatclient.common.template_utils.'
|
@mock.patch('heatclient.common.template_utils.'
|
||||||
'process_environment_and_files', autospec=True)
|
'process_environment_and_files', autospec=True)
|
||||||
|
@ -535,7 +539,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||||
mock_update_parameters, mock_post_config,
|
mock_update_parameters, mock_post_config,
|
||||||
mock_stack_network_check, mock_ceph_fsid,
|
mock_stack_network_check, mock_ceph_fsid,
|
||||||
mock_copy, mock_nic_ansible,
|
mock_copy, mock_nic_ansible,
|
||||||
mock_process_env, mock_rc_params):
|
mock_process_env, mock_rc_params,
|
||||||
|
mock_check_service_vip_migr):
|
||||||
fixture = deployment.DeploymentWorkflowFixture()
|
fixture = deployment.DeploymentWorkflowFixture()
|
||||||
self.useFixture(fixture)
|
self.useFixture(fixture)
|
||||||
utils_overcloud_fixture = deployment.UtilsOvercloudFixture()
|
utils_overcloud_fixture = deployment.UtilsOvercloudFixture()
|
||||||
|
@ -715,6 +720,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||||
self.assertFalse(utils_fixture.mock_deploy_tht.called)
|
self.assertFalse(utils_fixture.mock_deploy_tht.called)
|
||||||
self.assertFalse(mock_create_tempest_deployer_input.called)
|
self.assertFalse(mock_create_tempest_deployer_input.called)
|
||||||
|
|
||||||
|
@mock.patch('tripleoclient.utils.check_service_vips_migrated_to_service')
|
||||||
@mock.patch('tripleoclient.utils.get_rc_params', autospec=True)
|
@mock.patch('tripleoclient.utils.get_rc_params', autospec=True)
|
||||||
@mock.patch('tripleo_common.utils.plan.generate_passwords',
|
@mock.patch('tripleo_common.utils.plan.generate_passwords',
|
||||||
return_value={})
|
return_value={})
|
||||||
|
@ -739,7 +745,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||||
mock_ceph_fsid, mock_get_undercloud_host_entry,
|
mock_ceph_fsid, mock_get_undercloud_host_entry,
|
||||||
mock_copy, mock_nic_ansible,
|
mock_copy, mock_nic_ansible,
|
||||||
mock_roles_data, mock_image_prepare,
|
mock_roles_data, mock_image_prepare,
|
||||||
mock_generate_password, mock_rc_params):
|
mock_generate_password, mock_rc_params,
|
||||||
|
mock_check_service_vip_migr):
|
||||||
fixture = deployment.DeploymentWorkflowFixture()
|
fixture = deployment.DeploymentWorkflowFixture()
|
||||||
self.useFixture(fixture)
|
self.useFixture(fixture)
|
||||||
clients = self.app.client_manager
|
clients = self.app.client_manager
|
||||||
|
@ -814,6 +821,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||||
output_dir=self.cmd.working_dir)
|
output_dir=self.cmd.working_dir)
|
||||||
mock_copy.assert_called_once()
|
mock_copy.assert_called_once()
|
||||||
|
|
||||||
|
@mock.patch('tripleoclient.utils.check_service_vips_migrated_to_service')
|
||||||
@mock.patch('tripleoclient.utils.get_rc_params', autospec=True)
|
@mock.patch('tripleoclient.utils.get_rc_params', autospec=True)
|
||||||
@mock.patch('tripleo_common.utils.plan.generate_passwords',
|
@mock.patch('tripleo_common.utils.plan.generate_passwords',
|
||||||
return_value={})
|
return_value={})
|
||||||
|
@ -843,7 +851,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||||
mock_roles_data,
|
mock_roles_data,
|
||||||
mock_image_prepare,
|
mock_image_prepare,
|
||||||
mock_generate_password,
|
mock_generate_password,
|
||||||
mock_rc_params):
|
mock_rc_params,
|
||||||
|
mock_check_service_vip_migr):
|
||||||
clients = self.app.client_manager
|
clients = self.app.client_manager
|
||||||
orchestration_client = clients.orchestration
|
orchestration_client = clients.orchestration
|
||||||
mock_stack = fakes.create_tht_stack()
|
mock_stack = fakes.create_tht_stack()
|
||||||
|
@ -1231,6 +1240,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||||
self.assertTrue(fixture.mock_config_download.called)
|
self.assertTrue(fixture.mock_config_download.called)
|
||||||
mock_copy.assert_called_once()
|
mock_copy.assert_called_once()
|
||||||
|
|
||||||
|
@mock.patch('tripleoclient.utils.check_service_vips_migrated_to_service')
|
||||||
@mock.patch('tripleo_common.utils.plan.default_image_params',
|
@mock.patch('tripleo_common.utils.plan.default_image_params',
|
||||||
autospec=True)
|
autospec=True)
|
||||||
@mock.patch('tripleoclient.utils.get_rc_params', autospec=True)
|
@mock.patch('tripleoclient.utils.get_rc_params', autospec=True)
|
||||||
|
@ -1262,7 +1272,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||||
mock_get_ctlplane_attrs, mock_nic_ansible,
|
mock_get_ctlplane_attrs, mock_nic_ansible,
|
||||||
mock_process_env, mock_roles_data,
|
mock_process_env, mock_roles_data,
|
||||||
mock_container_prepare, mock_generate_password,
|
mock_container_prepare, mock_generate_password,
|
||||||
mock_rc_params, mock_default_image_params):
|
mock_rc_params, mock_default_image_params,
|
||||||
|
mock_check_service_vip_migr):
|
||||||
fixture = deployment.DeploymentWorkflowFixture()
|
fixture = deployment.DeploymentWorkflowFixture()
|
||||||
self.useFixture(fixture)
|
self.useFixture(fixture)
|
||||||
utils_fixture = deployment.UtilsOvercloudFixture()
|
utils_fixture = deployment.UtilsOvercloudFixture()
|
||||||
|
|
|
@ -1111,6 +1111,27 @@ def check_nic_config_with_ansible(stack, environment):
|
||||||
"in 'parameter_defaults'.")
|
"in 'parameter_defaults'.")
|
||||||
|
|
||||||
|
|
||||||
|
def check_service_vips_migrated_to_service(stack, environment):
|
||||||
|
registry = environment.get('resource_registry', {})
|
||||||
|
stack_registry = {}
|
||||||
|
if stack:
|
||||||
|
stack_registry = stack.environment().get(
|
||||||
|
'resource_registry', {})
|
||||||
|
removed_resources = {'OS::TripleO::Network::Ports::RedisVipPort',
|
||||||
|
'OS::TripleO::Network::Ports::OVNDBsVipPort'}
|
||||||
|
msg = ("Resources 'OS::TripleO::Network::Ports::RedisVipPort' and "
|
||||||
|
"'OS::TripleO::Network::Ports::OVNDBsVipPort' can no longer be "
|
||||||
|
"used. Service VIPs has been moved to the service definition "
|
||||||
|
"template. To configure a specific IP address use the parameters "
|
||||||
|
"'RedisVirtualFixedIPs' and/or 'OVNDBsVirtualFixedIPs'. To control"
|
||||||
|
"the network or subnet for VIP allocation set up the "
|
||||||
|
"'ServiceNetMap' and/or 'VipSubnetMap' parameters with the desired "
|
||||||
|
"network and/or subnet for the service.")
|
||||||
|
for resource in removed_resources:
|
||||||
|
if resource in registry or resource in stack_registry:
|
||||||
|
raise exceptions.InvalidConfiguration(msg)
|
||||||
|
|
||||||
|
|
||||||
def check_stack_network_matches_env_files(stack, environment):
|
def check_stack_network_matches_env_files(stack, environment):
|
||||||
"""Check stack against proposed env files to ensure non-breaking change
|
"""Check stack against proposed env files to ensure non-breaking change
|
||||||
|
|
||||||
|
|
|
@ -351,6 +351,8 @@ class DeployOvercloud(command.Command):
|
||||||
utils.check_ceph_fsid_matches_env_files(stack, env)
|
utils.check_ceph_fsid_matches_env_files(stack, env)
|
||||||
# check migration to new nic config with ansible
|
# check migration to new nic config with ansible
|
||||||
utils.check_nic_config_with_ansible(stack, env)
|
utils.check_nic_config_with_ansible(stack, env)
|
||||||
|
# check migration to service vips managed by servce
|
||||||
|
utils.check_service_vips_migrated_to_service(stack, env)
|
||||||
|
|
||||||
# FIXME(shardy) It'd be better to validate this via mistral
|
# FIXME(shardy) It'd be better to validate this via mistral
|
||||||
# e.g part of the plan create/update workflow
|
# e.g part of the plan create/update workflow
|
||||||
|
|
Loading…
Reference in New Issue