Browse Source

Merge "Don't allow Redis/OvnDBs VIP in resource_registry"

changes/84/769984/50
Zuul 3 weeks ago
committed by Gerrit Code Review
parent
commit
7a1c4e2b0b
4 changed files with 62 additions and 6 deletions
  1. +22
    -0
      tripleoclient/tests/test_utils.py
  2. +17
    -6
      tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py
  3. +21
    -0
      tripleoclient/utils.py
  4. +2
    -0
      tripleoclient/v1/overcloud_deploy.py

+ 22
- 0
tripleoclient/tests/test_utils.py View File

@ -466,6 +466,28 @@ class TestWaitForStackUtil(TestCase):
utils.check_nic_config_with_ansible,
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):
stack_reg = {
'OS::TripleO::Controller::Net::SoftwareConfig': 'val',


+ 17
- 6
tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py View File

@ -111,6 +111,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
os.unlink(self.parameter_defaults_env_file)
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('tripleo_common.utils.plan.default_image_params',
autospec=True)
@ -153,7 +154,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_process_env, mock_roles_data,
mock_container_prepare, mock_generate_password,
mock_rc_params, mock_default_image_params,
mock_stack_data):
mock_stack_data, mock_check_service_vip_migr):
fixture = deployment.DeploymentWorkflowFixture()
self.useFixture(fixture)
clients = self.app.client_manager
@ -414,6 +415,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.cmd.take_action(parsed_args)
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.get_rc_params', autospec=True)
@mock.patch('tripleo_common.utils.plan.generate_passwords',
@ -454,7 +456,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_image_prepare,
mock_generate_password,
mock_rc_params,
mock_stack_data):
mock_stack_data,
mock_check_service_vip_migr):
fixture = deployment.DeploymentWorkflowFixture()
self.useFixture(fixture)
utils_fixture = deployment.UtilsFixture()
@ -518,6 +521,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.cmd.take_action, parsed_args)
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('heatclient.common.template_utils.'
'process_environment_and_files', autospec=True)
@ -535,7 +539,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_update_parameters, mock_post_config,
mock_stack_network_check, mock_ceph_fsid,
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()
self.useFixture(fixture)
utils_overcloud_fixture = deployment.UtilsOvercloudFixture()
@ -715,6 +720,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.assertFalse(utils_fixture.mock_deploy_tht.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('tripleo_common.utils.plan.generate_passwords',
return_value={})
@ -739,7 +745,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_ceph_fsid, mock_get_undercloud_host_entry,
mock_copy, mock_nic_ansible,
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()
self.useFixture(fixture)
clients = self.app.client_manager
@ -814,6 +821,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
output_dir=self.cmd.working_dir)
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('tripleo_common.utils.plan.generate_passwords',
return_value={})
@ -843,7 +851,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_roles_data,
mock_image_prepare,
mock_generate_password,
mock_rc_params):
mock_rc_params,
mock_check_service_vip_migr):
clients = self.app.client_manager
orchestration_client = clients.orchestration
mock_stack = fakes.create_tht_stack()
@ -1231,6 +1240,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.assertTrue(fixture.mock_config_download.called)
mock_copy.assert_called_once()
@mock.patch('tripleoclient.utils.check_service_vips_migrated_to_service')
@mock.patch('tripleo_common.utils.plan.default_image_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_process_env, mock_roles_data,
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()
self.useFixture(fixture)
utils_fixture = deployment.UtilsOvercloudFixture()


+ 21
- 0
tripleoclient/utils.py View File

@ -1111,6 +1111,27 @@ def check_nic_config_with_ansible(stack, environment):
"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):
"""Check stack against proposed env files to ensure non-breaking change


+ 2
- 0
tripleoclient/v1/overcloud_deploy.py View File

@ -351,6 +351,8 @@ class DeployOvercloud(command.Command):
utils.check_ceph_fsid_matches_env_files(stack, env)
# check migration to new nic config with ansible
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
# e.g part of the plan create/update workflow


Loading…
Cancel
Save