summaryrefslogtreecommitdiffstats
path: root/openshift-storage-libs
diff options
context:
space:
mode:
authorNitin Goyal <nigoyal@redhat.com>2019-08-28 13:07:14 +0530
committerNitin Goyal <nigoyal@redhat.com>2019-12-02 11:01:27 +0530
commitcb28f23637696288ae6a937b6ac1e97315f7e8c2 (patch)
treefbc67ba879bc682354969c190b66ec455882f3ab /openshift-storage-libs
parentd935480c94b3506c392cf0e7c70c95d890f13e1f (diff)
Add TC heketi vol creation of size greater than device size
Add new TC heketi volume creation of size greater than the device size and verify backup-volfile-servers, replicacount, brickscount etc. Change-Id: I87cbf0e1d8326ad077f02cf465105aca3f8bdde7
Diffstat (limited to 'openshift-storage-libs')
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/heketi_ops.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/heketi_ops.py b/openshift-storage-libs/openshiftstoragelibs/heketi_ops.py
index f2c8196b..f1e535fa 100644
--- a/openshift-storage-libs/openshiftstoragelibs/heketi_ops.py
+++ b/openshift-storage-libs/openshiftstoragelibs/heketi_ops.py
@@ -1810,3 +1810,38 @@ def get_heketi_volume_and_brick_count_list(
volume_name_brick_count = [
(v['name'], len(v['bricks'])) for v in c['volumes']]
return volume_name_brick_count
+
+
+def get_vol_file_servers_and_hosts(
+ heketi_client_node, heketi_server_url, volume_id, **kwargs):
+ """Get volume file server and hosts.
+
+ Args:
+ heketi_client_node (str): Node on which cmd has to be executed.
+ heketi_server_url (str): Heketi server url
+ volume_id (str): Volume ID
+
+ Kwargs:
+ The keys, values in kwargs are:
+ - secret : (str)|None
+ - user : (str)|None
+
+ Returns:
+ dict: {'vol_servers': [], 'vol_hosts': []}
+
+ Raises:
+ AssertionError: if command fails.
+ """
+ if 'json' in kwargs:
+ raise AssertionError("json is not expected parameter")
+
+ kwargs['json'] = True
+
+ vol_info = heketi_volume_info(
+ heketi_client_node, heketi_server_url, volume_id, **kwargs)
+
+ glusterfs = vol_info['mount']['glusterfs']
+ vol_servers = (
+ glusterfs['device'].split(":")[:1]
+ + glusterfs['options']['backup-volfile-servers'].split(","))
+ return {'vol_servers': vol_servers, 'vol_hosts': glusterfs['hosts']}