From cb28f23637696288ae6a937b6ac1e97315f7e8c2 Mon Sep 17 00:00:00 2001 From: Nitin Goyal Date: Wed, 28 Aug 2019 13:07:14 +0530 Subject: 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 --- .../openshiftstoragelibs/heketi_ops.py | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'openshift-storage-libs/openshiftstoragelibs') 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']} -- cgit