diff options
author | kasturiNarra <knarra@redhat.com> | 2019-09-05 12:27:18 +0530 |
---|---|---|
committer | kasturiNarra <knarra@redhat.com> | 2019-09-09 19:16:50 +0530 |
commit | f12115a57964cb8fc13df788538e7b66852d358c (patch) | |
tree | eef36ac36f8141d88322c4d3ec0d650d31be5169 /openshift-storage-libs/openshiftstoragelibs/baseclass.py | |
parent | 93497a3dc587d49925a1223f56d9c8f10d792067 (diff) |
Move func get_block_hosting_volume_by_pvc_name to baseclass
Move get_block_hosting_volume_by_pvc_name from
test_restart_gluster_services to baseclass to
be able to reuse it in other test modules.
Change-Id: I65847792601b422293d4baed2ccade664ad7e54b
Diffstat (limited to 'openshift-storage-libs/openshiftstoragelibs/baseclass.py')
-rw-r--r-- | openshift-storage-libs/openshiftstoragelibs/baseclass.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/baseclass.py b/openshift-storage-libs/openshiftstoragelibs/baseclass.py index 2f90071c..306623da 100644 --- a/openshift-storage-libs/openshiftstoragelibs/baseclass.py +++ b/openshift-storage-libs/openshiftstoragelibs/baseclass.py @@ -8,6 +8,9 @@ from openshiftstoragelibs.exceptions import ( ConfigError, ExecutionError, ) +from openshiftstoragelibs.gluster_ops import ( + get_block_hosting_volume_name, +) from openshiftstoragelibs.heketi_ops import ( hello_heketi, heketi_blockvolume_delete, @@ -438,3 +441,23 @@ class GlusterBlockBaseClass(BaseClass): for state in ['failed', 'faulty', 'undef']: 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): + """Get block hosting volume of pvc name given + + Args: + pvc_name (str): pvc name for which the BHV name needs + to be returned + """ + pv_name = get_pv_name_from_pvc(self.node, pvc_name) + block_volume = oc_get_custom_resource( + self.node, 'pv', + r':.metadata.annotations."gluster\.org\/volume\-id"', + name=pv_name + )[0] + + # 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) + + return block_hosting_vol |