Skip to content

Commit

Permalink
Update getting the "ocs-osd-removal-job" name 4.14 #8879 (#8964)
Browse files Browse the repository at this point in the history
Signed-off-by: Itzhak Kave <[email protected]>
  • Loading branch information
yitzhak12 authored Dec 12, 2023
1 parent b6adff9 commit 8697b13
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
24 changes: 3 additions & 21 deletions ocs_ci/ocs/resources/pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"]
)
Expand Down
7 changes: 7 additions & 0 deletions tests/manage/z_cluster/nodes/test_disk_failures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 8697b13

Please sign in to comment.