diff --git a/ocs_ci/ocs/resources/pod.py b/ocs_ci/ocs/resources/pod.py index 35766662db2..05f47c418a1 100644 --- a/ocs_ci/ocs/resources/pod.py +++ b/ocs_ci/ocs/resources/pod.py @@ -2378,36 +2378,18 @@ def list_of_nodes_running_pods( return list(set(pods_running_nodes)) -def get_osd_removal_pod_name(osd_id, timeout=60): +def get_osd_removal_pod_name(timeout=60): """ Get the osd removal pod name Args: - osd_id (int): The osd's id to get the osd removal pod name timeout (int): The time to wait for getting the osd removal pod name Returns: str: The osd removal pod name """ - ocs_version_pattern_dict = { - "4.6": f"ocs-osd-removal-{osd_id}", - "4.7": "ocs-osd-removal-job", - "4.8": "ocs-osd-removal-", - "4.9": "ocs-osd-removal-job", - "4.10": "ocs-osd-removal-job", - "4.11": "ocs-osd-removal-job", - "4.12": "ocs-osd-removal-job", - } - - ocs_version = config.ENV_DATA["ocs_version"] - pattern = ocs_version_pattern_dict.get(ocs_version) - if not pattern: - logger.warning( - f"ocs version {ocs_version} didn't match any of the known versions" - ) - return None - + pattern = "ocs-osd-removal-job" try: for osd_removal_pod_names in TimeoutSampler( timeout=timeout, @@ -2532,7 +2514,7 @@ def verify_osd_removal_job_completed_successfully(osd_id): """ logger.info("Getting the ocs-osd-removal pod name") - osd_removal_pod_name = get_osd_removal_pod_name(osd_id) + osd_removal_pod_name = get_osd_removal_pod_name() osd_removal_pod_obj = get_pod_obj( osd_removal_pod_name, namespace=config.ENV_DATA["cluster_namespace"] ) diff --git a/tests/manage/z_cluster/nodes/test_disk_failures.py b/tests/manage/z_cluster/nodes/test_disk_failures.py index 5395c3f72fb..e684350394b 100644 --- a/tests/manage/z_cluster/nodes/test_disk_failures.py +++ b/tests/manage/z_cluster/nodes/test_disk_failures.py @@ -23,10 +23,14 @@ from ocs_ci.ocs.resources.pod import ( get_osd_pods, get_pod_node, + delete_pods, + get_pod_objs, ) from ocs_ci.utility.aws import AWSTimeoutException from ocs_ci.ocs.resources.storage_cluster import osd_encryption_verification from ocs_ci.ocs import osd_operations +from ocs_ci.ocs.utils import get_pod_name_by_pattern + logger = logging.getLogger(__name__) @@ -111,6 +115,9 @@ def finalizer(): logger.info("Clear crash warnings and osd removal leftovers") clear_crash_warning_and_osd_removal_leftovers() + logger.info("Deleting the ocs-osd-removal pods") + pod_names = get_pod_name_by_pattern("ocs-osd-removal-job-") + delete_pods(get_pod_objs(pod_names)) request.addfinalizer(finalizer)