summaryrefslogtreecommitdiffstats
path: root/openshift-storage-libs
diff options
context:
space:
mode:
authorArun Kumar <arukumar@redhat.com>2019-11-15 14:23:35 +0530
committerArun Kumar <arukumar@redhat.com>2020-02-20 11:47:40 +0530
commit6de6312070b5705fac73f5e834c158f62a51dcd3 (patch)
tree200cd7e27953eef7b69710c2670f1107f070b211 /openshift-storage-libs
parent818f744afe9c8fe0347d57ea689320c400cf4922 (diff)
[Test] Add tc to validate cassandra pod when BHV brick process is down
Change-Id: If0024c4b99eee0d0971077556b033ace5104c982
Diffstat (limited to 'openshift-storage-libs')
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/baseclass.py13
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/gluster_ops.py15
2 files changed, 24 insertions, 4 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/baseclass.py b/openshift-storage-libs/openshiftstoragelibs/baseclass.py
index b8080d23..f30c2bad 100644
--- a/openshift-storage-libs/openshiftstoragelibs/baseclass.py
+++ b/openshift-storage-libs/openshiftstoragelibs/baseclass.py
@@ -738,13 +738,21 @@ class GlusterBlockBaseClass(BaseClass):
msg = "All paths are not up in mpath %s on Node %s" % (out, node)
self.assertNotIn(state, out, msg)
- def get_block_hosting_volume_by_pvc_name(self, pvc_name):
+ def get_block_hosting_volume_by_pvc_name(
+ self, pvc_name, heketi_server_url=None, gluster_node=None,
+ ocp_client_node=None):
"""Get block hosting volume of pvc name given
Args:
pvc_name (str): pvc name for which the BHV name needs
to be returned
+ Kwargs:
+ heketi_server_url (str): heketi server url to run heketi commands
+ gluster_node (str): gluster node where to run gluster commands
+ ocp_client_node (str): ocp cleint node where to run oc commands
"""
+ if not heketi_server_url:
+ heketi_server_url = self.heketi_server_url
pv_name = get_pv_name_from_pvc(self.ocp_client[0], pvc_name)
block_volume = oc_get_custom_resource(
self.ocp_client[0], 'pv',
@@ -754,6 +762,7 @@ class GlusterBlockBaseClass(BaseClass):
# get block hosting volume from block volume
block_hosting_vol = get_block_hosting_volume_name(
- self.heketi_client_node, self.heketi_server_url, block_volume)
+ self.heketi_client_node, heketi_server_url, block_volume,
+ gluster_node=gluster_node, ocp_client_node=ocp_client_node)
return block_hosting_vol
diff --git a/openshift-storage-libs/openshiftstoragelibs/gluster_ops.py b/openshift-storage-libs/openshiftstoragelibs/gluster_ops.py
index 422c8a01..d7df73ac 100644
--- a/openshift-storage-libs/openshiftstoragelibs/gluster_ops.py
+++ b/openshift-storage-libs/openshiftstoragelibs/gluster_ops.py
@@ -240,7 +240,8 @@ def match_heketi_and_gluster_block_volumes_by_prefix(
@podcmd.GlustoPod()
def get_block_hosting_volume_name(heketi_client_node, heketi_server_url,
- block_volume):
+ block_volume, gluster_node=None,
+ ocp_client_node=None):
"""Returns block hosting volume name of given block volume
Args:
@@ -248,6 +249,10 @@ def get_block_hosting_volume_name(heketi_client_node, heketi_server_url,
heketi_server_url (str): Heketi server url
block_volume (str): Block volume of which block hosting volume
returned
+ Kwargs:
+ gluster_node (str): gluster node/pod ip where gluster command can be
+ run
+ ocp_client_node (str): OCP client node where oc commands can be run
Returns:
str : Name of the block hosting volume for given block volume
"""
@@ -263,7 +268,13 @@ def get_block_hosting_volume_name(heketi_client_node, heketi_server_url,
if not block_hosting_vol_match:
continue
- gluster_vol_list = get_volume_list("auto_get_gluster_endpoint")
+ if gluster_node and ocp_client_node:
+ cmd = 'gluster volume list'
+ gluster_vol_list = cmd_run_on_gluster_pod_or_node(
+ ocp_client_node, cmd, gluster_node).split('\n')
+ else:
+ gluster_vol_list = get_volume_list('auto_get_gluster_endpoint')
+
for vol in gluster_vol_list:
if block_hosting_vol_match.group(1).strip() in vol:
return vol