diff --git a/ocs_ci/deployment/baremetal.py b/ocs_ci/deployment/baremetal.py index 5de7601393bb..4ff20705b77c 100644 --- a/ocs_ci/deployment/baremetal.py +++ b/ocs_ci/deployment/baremetal.py @@ -1292,7 +1292,7 @@ def clean_disk(worker, namespace=constants.BM_DEBUG_NODE_NS): for lsblk_device in lsblk_devices: if lsblk_device["name"] in selected_disks_to_ignore_cleanup: - print(f'the disk cleanup is ignored for, {lsblk_device["name"]}') + logger.info(f'the disk cleanup is ignored for, {lsblk_device["name"]}') pass else: logger.info(f"Cleaning up {lsblk_device['name']}") diff --git a/ocs_ci/deployment/deployment.py b/ocs_ci/deployment/deployment.py index 603c9556c3e8..23d12c327a11 100644 --- a/ocs_ci/deployment/deployment.py +++ b/ocs_ci/deployment/deployment.py @@ -529,10 +529,10 @@ def do_deploy_odf_provider_mode(self): """ # deploy provider-client deployment from ocs_ci.deployment.provider_client.storage_client_deployment import ( - StorageClientDeployment, + ODFAndNativeStorageClientDeploymentOnProvider, ) - storage_client_deployment_obj = StorageClientDeployment() + storage_client_deployment_obj = ODFAndNativeStorageClientDeploymentOnProvider() # Provider-client deployment if odf_provider_mode_deployment: True if ( diff --git a/ocs_ci/deployment/provider_client/storage_client_deployment.py b/ocs_ci/deployment/provider_client/storage_client_deployment.py index dead1346778c..1165e6c59684 100644 --- a/ocs_ci/deployment/provider_client/storage_client_deployment.py +++ b/ocs_ci/deployment/provider_client/storage_client_deployment.py @@ -1,6 +1,5 @@ """ -This module provides installation of ODF in provider mode and storage-client creation -on the hosting cluster. +This module provides installation of ODF and native storage-client creation in provider mode """ import atexit import logging @@ -14,8 +13,6 @@ from ocs_ci.ocs.rados_utils import RadosHelper from ocs_ci.deployment.helpers.lso_helpers import setup_local_storage from ocs_ci.ocs.node import label_nodes, get_all_nodes, get_node_objs - -# from ocs_ci.utility.retry import retry from ocs_ci.ocs.ui.validation_ui import ValidationUI from ocs_ci.ocs.ui.base_ui import login_ui, close_browser from ocs_ci.ocs.utils import ( @@ -46,7 +43,7 @@ log = logging.getLogger(__name__) -class StorageClientDeployment(object): +class ODFAndNativeStorageClientDeploymentOnProvider(object): def __init__(self): log.info("Initializing webdriver and login to webconsole") # Call a function during initialization diff --git a/ocs_ci/ocs/rados_utils.py b/ocs_ci/ocs/rados_utils.py index 90262dec3123..7dcd75b38d3c 100644 --- a/ocs_ci/ocs/rados_utils.py +++ b/ocs_ci/ocs/rados_utils.py @@ -288,6 +288,8 @@ def verify_cephblockpool_status( Args: pool_name (str): The name of the Ceph block pool + namespace(str): cluster namespace + required_phase(str): required phase of the cephblockpool Returns: status: True if the Ceph block pool is in Ready status, False otherwise @@ -298,7 +300,6 @@ def verify_cephblockpool_status( f"oc get {constants.CEPHBLOCKPOOL} {pool_name} -n {namespace} " "-o=jsonpath='{.status.phase}'" ) - # phase = run_cmd(cmd=cmd) phase = retry((CommandFailed), tries=20, delay=10,)( run_cmd @@ -306,15 +307,15 @@ def verify_cephblockpool_status( logger.info(f"{pool_name} is in {phase} phase") logger.info(f"Required phase is {required_phase}") - if phase == required_phase: - return True - else: - return False + return phase == required_phase def fetch_rados_namespaces(self, namespace=None): """ Verify if rados namespace exists + Args: + namespace(str): cluster namespace + Returns: bool: True if the radosnamespace exists, False otherwise """ @@ -333,6 +334,10 @@ def check_phase_of_rados_namespace( """ Verify if rados namespace exists + Args: + namespace(str): cluster namespace + required_phase(str): required phase of the rados namespace + Returns: bool: True if the radosnamespace exists, False otherwise """ @@ -345,7 +350,7 @@ def check_phase_of_rados_namespace( "-o=jsonpath='{.status.phase}'" ) phase = run_cmd(cmd=check_radosns_phase_cmd) - return True if phase == required_phase else False + return phase == required_phase def corrupt_pg(osd_deployment, pool_name, pool_object): diff --git a/ocs_ci/ocs/resources/storage_client.py b/ocs_ci/ocs/resources/storage_client.py index a3100183e81f..74aa378e040e 100644 --- a/ocs_ci/ocs/resources/storage_client.py +++ b/ocs_ci/ocs/resources/storage_client.py @@ -14,15 +14,30 @@ run_cmd, ) from ocs_ci.utility import templating -from ocs_ci.ocs.resources.storage_cluster import ( - check_storage_client_status, -) from ocs_ci.helpers.managed_services import verify_storageclient_storageclass_claims log = logging.getLogger(__name__) +def check_storage_client_status(namespace=constants.OPENSHIFT_STORAGE_CLIENT_NAMESPACE): + """ + Check storageclient status + + Inputs: + namespace(str): Namespace where the storage client is created + + Returns: + storageclient_status(str): storageclient phase + + """ + cmd = ( + f"oc get storageclient -n {namespace} " "-o=jsonpath='{.items[*].status.phase}'" + ) + storageclient_status = run_cmd(cmd=cmd) + return storageclient_status + + @retry(AssertionError, 12, 10, 1) def create_storage_client( storage_provider_endpoint=None, @@ -43,7 +58,7 @@ def create_storage_client( log.info("Pulling storageclient CR data from yaml") storage_client_data = templating.load_yaml(constants.STORAGE_CLIENT_YAML) resource_name = storage_client_data["metadata"]["name"] - print(f"the resource name: {resource_name}") + log.info(f"the resource name: {resource_name}") # Check storageclient is available or not storage_client_obj = ocp.OCP(kind="storageclient") diff --git a/ocs_ci/ocs/resources/storage_cluster.py b/ocs_ci/ocs/resources/storage_cluster.py index a74c827ddae0..356f5c491bfe 100644 --- a/ocs_ci/ocs/resources/storage_cluster.py +++ b/ocs_ci/ocs/resources/storage_cluster.py @@ -2728,21 +2728,3 @@ def resize_osd(new_osd_size, check_size=True): format_type="json", ) return res - - -def check_storage_client_status(namespace=constants.OPENSHIFT_STORAGE_CLIENT_NAMESPACE): - """ - Check storageclient status - - Inputs: - namespace(str): Namespace where the storage client is created - - Returns: - storageclient_status(str): storageclient phase - - """ - cmd = ( - f"oc get storageclient -n {namespace} " "-o=jsonpath='{.items[*].status.phase}'" - ) - storageclient_status = run_cmd(cmd=cmd) - return storageclient_status diff --git a/ocs_ci/ocs/utils.py b/ocs_ci/ocs/utils.py index 80cc78cb2a66..c23701963584 100644 --- a/ocs_ci/ocs/utils.py +++ b/ocs_ci/ocs/utils.py @@ -1472,15 +1472,7 @@ def enable_console_plugin(value="[odf-console]"): and ocsci_config.ENV_DATA["enable_console_plugin"] ): log.info("Enabling console plugin") - # ocp_obj = OCP() - # patch = '\'[{"op": "add", "path": "/spec/plugins", "value": ["odf-console"]}]\'' - # patch_cmd = ( - # f"patch console.operator cluster -n {ocsci_config.ENV_DATA['cluster_namespace']}" - # f" --type json -p {patch}" - # ) - # ocp_obj.exec_oc_cmd(command=patch_cmd) path = "/spec/plugins" - # value = "[odf-console]" params = f"""[{{"op": "add", "path": "{path}", "value": {value}}}]""" ocp_obj = OCP(kind=constants.CONSOLE_CONFIG) ocp_obj.patch(params=params, format_type="json"), (