summaryrefslogtreecommitdiffstats
path: root/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
diff options
context:
space:
mode:
authorArun Kumar <arukumar@arukumar.remote.csb>2019-09-16 15:17:49 +0530
committerArun <arukumar@redhat.com>2019-11-26 18:42:01 +0530
commitf51ac495904dcd43649dbdc9a3997593aa8f9164 (patch)
treec4221031a71f45cb1c474b9675f5d7eb74491426 /openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
parent1ed3d8401476b56e1f84cfdb9eb849f07cc80af8 (diff)
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
Diffstat (limited to 'openshift-storage-libs/openshiftstoragelibs/openshift_ops.py')
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/openshift_ops.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
index 56b0629..4e668d6 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]}