Merge "Fail the overcloud deploy is ceph-ansible.yaml is included"

This commit is contained in:
Zuul 2021-08-05 12:03:49 +00:00 committed by Gerrit Code Review
commit 8031acb16b
4 changed files with 69 additions and 4 deletions

View File

@ -872,6 +872,31 @@ class TestWaitForStackUtil(TestCase):
with self.assertRaises(exceptions.InvalidConfiguration):
utils.check_ceph_fsid_matches_env_files(mock_stack, provided_env)
def test_check_ceph_ansible(self):
res_reg = {
'resource_registry': {
'OS::Tripleo::Services::CephMon': '/path/to/ceph-ansible.yml',
}
}
utils.check_ceph_ansible(res_reg.get('resource_registry', {}),
'UpgradePrepare')
utils.check_ceph_ansible(res_reg.get('resource_registry', {}),
'UpgradeConverge')
def test_check_ceph_ansible_fail(self):
res_reg = {
'resource_registry': {
'OS::Tripleo::Services::CephMon': '/path/to/ceph-ansible.yml',
}
}
with self.assertRaises(exceptions.InvalidConfiguration):
utils.check_ceph_ansible(res_reg.get('resource_registry', {}),
'DeployOvercloud')
def test_check_swift_and_rgw(self):
stack_reg = {
'OS::TripleO::Services::SwiftProxy': 'OS::Heat::None',

View File

@ -153,6 +153,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
@mock.patch('tripleoclient.utils.check_stack_network_matches_env_files')
@mock.patch('tripleoclient.utils.check_ceph_fsid_matches_env_files')
@mock.patch('tripleoclient.utils.check_swift_and_rgw')
@mock.patch('tripleoclient.utils.check_ceph_ansible')
@mock.patch("heatclient.common.event_utils.get_events")
@mock.patch('tripleo_common.update.add_breakpoints_cleanup_into_env',
autospec=True)
@ -167,6 +168,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_breakpoints_cleanup,
mock_events, mock_stack_network_check,
mock_ceph_fsid, mock_swift_rgw,
mock_ceph_ansible,
mock_get_undercloud_host_entry, mock_copy,
mock_get_ctlplane_attrs, mock_nic_ansiblei,
mock_process_env, mock_roles_data,
@ -382,6 +384,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
@mock.patch('tripleoclient.utils.check_stack_network_matches_env_files')
@mock.patch('tripleoclient.utils.check_ceph_fsid_matches_env_files')
@mock.patch('tripleoclient.utils.check_swift_and_rgw')
@mock.patch('tripleoclient.utils.check_ceph_ansible')
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
'_deploy_postconfig', autospec=True)
@mock.patch('tripleo_common.update.add_breakpoints_cleanup_into_env',
@ -398,7 +401,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_create_parameters_env, mock_validate_args,
mock_breakpoints_cleanup,
mock_postconfig, mock_stack_network_check,
mock_ceph_fsid, mock_swift_rgw,
mock_ceph_fsid, mock_swift_rgw, mock_ceph_ansible,
mock_get_undercloud_host_entry, mock_copy,
mock_chdir,
mock_process_env, mock_roles_data,
@ -476,6 +479,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
@mock.patch('tripleoclient.utils.check_stack_network_matches_env_files')
@mock.patch('tripleoclient.utils.check_ceph_fsid_matches_env_files')
@mock.patch('tripleoclient.utils.check_swift_and_rgw')
@mock.patch('tripleoclient.utils.check_ceph_ansible')
@mock.patch("heatclient.common.event_utils.get_events", autospec=True)
@mock.patch('tripleo_common.update.add_breakpoints_cleanup_into_env',
autospec=True)
@ -491,6 +495,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_breakpoints_cleanup,
mock_events, mock_stack_network_check,
mock_ceph_fsid, mock_swift_rgw,
mock_ceph_ansible,
mock_get_undercloud_host_entry,
mock_copy, mock_nic_ansible,
mock_process_env,
@ -578,6 +583,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
@mock.patch('tripleoclient.utils.check_stack_network_matches_env_files')
@mock.patch('tripleoclient.utils.check_ceph_fsid_matches_env_files')
@mock.patch('tripleoclient.utils.check_swift_and_rgw')
@mock.patch('tripleoclient.utils.check_ceph_ansible')
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
'_deploy_postconfig', autospec=True)
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
@ -589,7 +595,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
def test_environment_dirs(self, mock_deploy_heat, mock_create_env,
mock_update_parameters, mock_post_config,
mock_stack_network_check, mock_ceph_fsid,
mock_swift_rgw, mock_copy, mock_nic_ansible,
mock_swift_rgw, mock_ceph_ansible,
mock_copy, mock_nic_ansible,
mock_process_env, mock_rc_params,
mock_check_service_vip_migr):
fixture = deployment.DeploymentWorkflowFixture()
@ -803,6 +810,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
@mock.patch('tripleoclient.utils.check_stack_network_matches_env_files')
@mock.patch('tripleoclient.utils.check_ceph_fsid_matches_env_files')
@mock.patch('tripleoclient.utils.check_swift_and_rgw')
@mock.patch('tripleoclient.utils.check_ceph_ansible')
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
'_heat_deploy', autospec=True)
@mock.patch('tempfile.mkdtemp', autospec=True)
@ -810,6 +818,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
def test_answers_file(self, mock_rmtree, mock_tmpdir,
mock_heat_deploy, mock_stack_network_check,
mock_ceph_fsid, mock_swift_rgw,
mock_ceph_ansible,
mock_get_undercloud_host_entry,
mock_copy, mock_nic_ansible,
mock_roles_data, mock_image_prepare,
@ -918,6 +927,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
@mock.patch('tripleoclient.utils.check_stack_network_matches_env_files')
@mock.patch('tripleoclient.utils.check_ceph_fsid_matches_env_files')
@mock.patch('tripleoclient.utils.check_swift_and_rgw')
@mock.patch('tripleoclient.utils.check_ceph_ansible')
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
'_deploy_postconfig', autospec=True)
@mock.patch('tripleo_common.update.add_breakpoints_cleanup_into_env')
@ -938,6 +948,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_deploy_post_config,
mock_stack_network_check,
mock_ceph_fsid, mock_swift_rgw,
mock_ceph_ansible,
mock_get_undercloud_host_entry, mock_copy,
mock_get_ctlplane_attrs,
mock_roles_data,
@ -1332,11 +1343,12 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
@mock.patch('tripleoclient.utils.check_stack_network_matches_env_files')
@mock.patch('tripleoclient.utils.check_ceph_fsid_matches_env_files')
@mock.patch('tripleoclient.utils.check_swift_and_rgw')
@mock.patch('tripleoclient.utils.check_ceph_ansible')
@mock.patch('heatclient.common.template_utils.deep_update', autospec=True)
def test_config_download_timeout(
self, mock_hc, mock_stack_network_check,
mock_ceph_fsid, mock_swift_rgw, mock_hd,
mock_get_undercloud_host_entry, mock_copy,
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_process_env, mock_roles_data,
mock_container_prepare, mock_generate_password,

View File

@ -1046,6 +1046,31 @@ def get_rc_params(orchestration_client, stack_name):
return rc_params
def check_ceph_ansible(resource_registry, stage):
"""Fail if ceph-ansible is still passed
If any of the ceph-ansible related resources are part of the
Ceph services path, then the overcloud deploy (or the stack
update) should fail, unless they are included in the context
of Update/Upgrade/Converge, where these environments are still
relevant and required.
"""
if not resource_registry or stage not in "DeployOvercloud":
return
# for each Ceph related service, fail if ceph-ansible is part
# of the provided path
for name, path in resource_registry.items():
if 'Ceph' in name and 'ceph-ansible' in path:
raise exceptions.InvalidConfiguration('The Ceph deployment is not '
'available anymore using '
'ceph-ansible. If you want '
'to deploy Ceph, please add '
'the cephadm environment '
'file.')
def check_ceph_fsid_matches_env_files(stack, environment):
"""Check CephClusterFSID against proposed env files

View File

@ -384,6 +384,9 @@ class DeployOvercloud(command.Command):
# upgrades: check if swift is deployed
utils.check_swift_and_rgw(stack, env,
self.__class__.__name__)
# check if ceph-ansible env is present
utils.check_ceph_ansible(env.get('resource_registry', {}),
self.__class__.__name__)
# check migration to new nic config with ansible
utils.check_nic_config_with_ansible(stack, env)
# check migration to service vips managed by servce