From f51ac495904dcd43649dbdc9a3997593aa8f9164 Mon Sep 17 00:00:00 2001 From: Arun Kumar Date: Mon, 16 Sep 2019 15:17:49 +0530 Subject: Add TC deleting bunch of PVC's during network failure Create network failure while deleting PVC's Network side failure is introduced by opening and closing the ports related to gluster-blockd. Change-Id: Id3a749aa1a051bbce99b85046fa0a79831e85dd5 --- .../openshiftstoragelibs/openshift_ops.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'openshift-storage-libs') diff --git a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py index 56b06297..4e668d68 100644 --- a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py +++ b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py @@ -1358,7 +1358,7 @@ def get_pv_name_from_pvc(hostname, pvc_name): return pv_name -def get_vol_names_from_pv(hostname, pv_name): +def get_vol_names_from_pv(hostname, pv_name, vol_type='file'): ''' Returns the heketi and gluster vol names of the corresponding PV @@ -1368,6 +1368,7 @@ def get_vol_names_from_pv(hostname, pv_name): pv_name (str): pv_name for which we want to find corresponding vol names + vol_type (str): volume type block or file Returns: volname (dict): dict if successful {"heketi_vol": heketi_vol_name, @@ -1377,10 +1378,15 @@ def get_vol_names_from_pv(hostname, pv_name): otherwise raise Exception ''' vol_dict = {} - cmd = (r"oc get pv %s -o=custom-columns=" - r":.metadata.annotations." - r"'gluster\.kubernetes\.io\/heketi\-volume\-id'," - r":.spec.glusterfs.path" % pv_name) + if vol_type == 'block': + cmd = (r"oc get pv %s -o=custom-columns=" + r":.metadata.annotations.'gluster\.org\/volume-id'," + r":.metadata.annotations.glusterBlockShare" % pv_name) + else: + cmd = (r"oc get pv %s -o=custom-columns=" + r":.metadata.annotations." + r"'gluster\.kubernetes\.io\/heketi\-volume\-id'," + r":.spec.glusterfs.path" % pv_name) vol_list = command.cmd_run(cmd, hostname=hostname).split() vol_dict = {"heketi_vol": vol_list[0], "gluster_vol": vol_list[1]} -- cgit