diff --git a/ocs_ci/deployment/provider_client/storage_client_deployment.py b/ocs_ci/deployment/provider_client/storage_client_deployment.py index 37d028e2c3f..d7d8823806b 100644 --- a/ocs_ci/deployment/provider_client/storage_client_deployment.py +++ b/ocs_ci/deployment/provider_client/storage_client_deployment.py @@ -40,6 +40,10 @@ check_phase_of_rados_namespace, ) from ocs_ci.ocs.exceptions import CommandFailed +from ocs_ci.helpers.managed_services import ( + verify_storageclient, + verify_storageclient_storageclass_claims, +) log = logging.getLogger(__name__) @@ -224,7 +228,9 @@ def provider_and_native_client_installation( log.info( f"Sleeping for 30 seconds after {self.ocs_client_operator} created" ) - # Validate storageclaims created + + # Validate storageclaims are Ready and associated storageclasses are created + verify_storageclient() # Validate cephblockpool created assert verify_block_pool_exists( @@ -574,11 +580,4 @@ def create_storage_client( f"apply -f {constants.STORAGE_CLASS_CLAIM_YAML}" ) time.sleep(30) - storage_class_classes = get_all_storageclass_names() - for storage_class in self.storage_class_claims: - assert ( - storage_class in storage_class_classes - ), "Storage classes ae not created as expected" - - else: - log.error("storageclassclaims are not created") + verify_storageclient_storageclass_claims(resource_name) diff --git a/ocs_ci/helpers/managed_services.py b/ocs_ci/helpers/managed_services.py index fe323dd7d4b..87a106b1077 100644 --- a/ocs_ci/helpers/managed_services.py +++ b/ocs_ci/helpers/managed_services.py @@ -28,6 +28,7 @@ from ocs_ci.utility.utils import convert_device_size, TimeoutSampler from ocs_ci.utility.aws import AWS import ocs_ci.ocs.cluster +from ocs_ci.utility import version log = logging.getLogger(__name__) @@ -253,6 +254,7 @@ def verify_storageclient( verify_sc (bool): True to verify the storageclassclaims and storageclasses associated with the storageclient. """ + ocs_version = version.get_semantic_ocs_version_from_config() storageclient_obj = OCP( kind=constants.STORAGECLIENT, namespace=namespace or config.ENV_DATA["cluster_namespace"], @@ -263,13 +265,20 @@ def verify_storageclient( else storageclient_obj.get()["items"][0] ) storageclient_name = storageclient["metadata"]["name"] - provider_name = provider_name or config.ENV_DATA.get("provider_name", "") - endpoint_actual = get_storage_provider_endpoint(provider_name) - assert storageclient["spec"]["storageProviderEndpoint"] == endpoint_actual, ( - f"The value of storageProviderEndpoint is not correct in the storageclient {storageclient['metadata']['name']}." - f" Value in storageclient is {storageclient['spec']['storageProviderEndpoint']}. " - f"Value in the provider cluster {provider_name} is {endpoint_actual}" - ) + + if ocs_version >= version.VERSION_4_16: + assert ( + storageclient["spec"]["storageProviderEndpoint"] + == "ocs-provider-server:50051" + ) + else: + provider_name = provider_name or config.ENV_DATA.get("provider_name", "") + endpoint_actual = get_storage_provider_endpoint(provider_name) + assert storageclient["spec"]["storageProviderEndpoint"] == endpoint_actual, ( + f"The value of storageProviderEndpoint is not correct in storageclient {storageclient['metadata']['name']}." + f" Value in storageclient is {storageclient['spec']['storageProviderEndpoint']}. " + f"Value in the provider cluster {provider_name} is {endpoint_actual}" + ) log.info( f"Verified the storageProviderEndpoint value in the storageclient {storageclient_name}" ) @@ -313,9 +322,16 @@ def get_all_storageclassclaims(): List: OCS objects of kind Storageclassclaim """ - sc_claim_obj = OCP( - kind=constants.STORAGECLASSCLAIM, namespace=config.ENV_DATA["cluster_namespace"] - ) + ocs_version = version.get_semantic_ocs_version_from_config() + if ocs_version >= version.VERSION_4_16: + sc_claim_obj = OCP( + kind=constants.STORAGECLAIM, namespace=config.ENV_DATA["cluster_namespace"] + ) + else: + sc_claim_obj = OCP( + kind=constants.STORAGECLASSCLAIM, + namespace=config.ENV_DATA["cluster_namespace"], + ) sc_claims_data = sc_claim_obj.get()["items"] return [OCS(**claim_data) for claim_data in sc_claims_data] diff --git a/ocs_ci/ocs/constants.py b/ocs_ci/ocs/constants.py index 2b0aaea8889..0b5d1a5b179 100644 --- a/ocs_ci/ocs/constants.py +++ b/ocs_ci/ocs/constants.py @@ -189,6 +189,7 @@ LVMCLUSTER = "odf-lvmcluster" LVMSCLUSTER = "lvmscluster" STORAGECLASSCLAIM = "StorageClassClaim" +STORAGECLAIM = "StorageClaim" STORAGECONSUMER = "StorageConsumer" MACHINEHEALTHCHECK = "machinehealthcheck" STORAGECLIENT = "StorageClient"