Skip to content

Commit

Permalink
Fix in storagecluster_independent_check for PC solution
Browse files Browse the repository at this point in the history
Signed-off-by: suchita-g <sgatfane@redhat.com>
This resolution for some of the instances in provider-client testrun with
below error: the server doesn't have a resource type "StorageCluster"
Signed-off-by: suchita-g <sgatfane@redhat.com>
  • Loading branch information
suchita-g committed Nov 27, 2023
1 parent aff64a5 commit 608bd89
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
14 changes: 12 additions & 2 deletions ocs_ci/helpers/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3014,15 +3014,25 @@ def storagecluster_independent_check():
bool: True if storagecluster is running on external mode False otherwise
"""
consumer_cluster_index = None
if config.ENV_DATA["platform"].lower() in constants.HCI_PC_OR_MS_PLATFORM:
# Get the index of current consumer cluster
consumer_cluster_index = config.cur_index
# Switch to provider cluster context
config.switch_to_provider()

storage_cluster = (
OCP(kind="StorageCluster", namespace=config.ENV_DATA["cluster_namespace"])
.get()
.get("items")[0]
)

return bool(
ret_val = bool(
storage_cluster.get("spec", {}).get("externalStorage", {}).get("enable", False)
)
if consumer_cluster_index is not None:
# Switch back to consumer cluster context
config.switch_to_consumer(consumer_cluster_index)
return ret_val


def get_pv_size(storageclass=None):
Expand Down
6 changes: 5 additions & 1 deletion ocs_ci/ocs/resources/pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,11 @@ def get_ceph_tools_pod(skip_creating_pod=False, namespace=None):
else:
cluster_kubeconfig = config.ENV_DATA.get("provider_kubeconfig", "")

namespace = namespace or config.ENV_DATA["cluster_namespace"]
if cluster_kubeconfig:
namespace = constants.OPENSHIFT_STORAGE_NAMESPACE
else:
namespace = namespace or config.ENV_DATA["cluster_namespace"]

ocp_pod_obj = OCP(
kind=constants.POD,
namespace=namespace,
Expand Down

0 comments on commit 608bd89

Please sign in to comment.