Skip to content

Commit

Permalink
Fix get_cephfs_subvolumegroup function for HCI client setup (#9020)
Browse files Browse the repository at this point in the history
Signed-off-by: Jilju Joy <jijoy@redhat.com>
  • Loading branch information
jilju authored Jan 16, 2024
1 parent 69acc5f commit 3fc994a
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions ocs_ci/helpers/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4094,18 +4094,28 @@ def get_cephfs_subvolumegroup():
str: The name of cephfilesystemsubvolumegroup
"""
if config.ENV_DATA.get(
"platform", ""
).lower() in constants.HCI_PC_OR_MS_PLATFORM and (
config.ENV_DATA.get("cluster_type", "").lower() == "consumer"
or config.ENV_DATA.get("cluster_type", "").lower() == constants.HCI_CLIENT
if (
config.ENV_DATA.get("platform", "").lower()
in constants.MANAGED_SERVICE_PLATFORMS
and config.ENV_DATA.get("cluster_type", "").lower() == "consumer"
):
subvolume_group = ocp.OCP(
kind=constants.CEPHFILESYSTEMSUBVOLUMEGROUP,
namespace=config.ENV_DATA["cluster_namespace"],
)
subvolume_group_obj = subvolume_group.get().get("items")[0]
subvolume_group_name = subvolume_group_obj.get("metadata").get("name")
elif config.ENV_DATA.get("cluster_type", "").lower() == constants.HCI_CLIENT:
configmap_obj = ocp.OCP(
kind=constants.CONFIGMAP,
namespace=config.ENV_DATA["cluster_namespace"],
)
ceph_csi_configmap = configmap_obj.get(resource_name="ceph-csi-configs")
json_config = ceph_csi_configmap.get("data").get("config.json")
json_config_list = json.loads(json_config)
for dict_item in json_config_list:
if "cephFS" in dict_item.keys():
subvolume_group_name = dict_item["cephFS"].get("subvolumeGroup")
else:
subvolume_group_name = "csi"

Expand Down

0 comments on commit 3fc994a

Please sign in to comment.