summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster/tiering_ops.py
diff options
context:
space:
mode:
authorShwethaHP <spandura@redhat.com>2017-11-30 13:19:11 +0530
committerJonathan Holloway <jholloway@redhat.com>2018-01-16 06:21:33 +0000
commit389862e34225430b06a1d494c1c1e3037f4b6d5d (patch)
treef762786f17070ac88d6ecc1859072d243955fa12 /glustolibs-gluster/glustolibs/gluster/tiering_ops.py
parentc39a42140f328d12a605f5480d0e3c7a2d4c6308 (diff)
Check if servers/nodes which is expected to be passed as list
is str. i.e passing a single node to the function. If it is str, then convert it to list Change-Id: I1abacf62fdbe1ec56fe85c86d8e2a323a2c3971b Signed-off-by: ShwethaHP <spandura@redhat.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster/tiering_ops.py')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/tiering_ops.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/tiering_ops.py b/glustolibs-gluster/glustolibs/gluster/tiering_ops.py
index 755ca276a..7e48a48c7 100644
--- a/glustolibs-gluster/glustolibs/gluster/tiering_ops.py
+++ b/glustolibs-gluster/glustolibs/gluster/tiering_ops.py
@@ -37,7 +37,8 @@ def add_extra_servers_to_cluster(mnode, extra_servers):
Args:
mnode (str): Node on which cmd has to be executed.
- extra_servers (list) : list of extra servers to be attached to cluster
+ extra_servers (str|list) : A server|list of extra servers to be
+ attached to cluster
Returns:
bool: True, if extra servers are attached to cluster
@@ -47,7 +48,7 @@ def add_extra_servers_to_cluster(mnode, extra_servers):
add_extra_servers_to_cluster("abc.com", ['peer_node1','peer_node2'])
"""
- if not isinstance(extra_servers, list):
+ if isinstance(extra_servers, str):
extra_servers = [extra_servers]
ret = start_glusterd(servers=extra_servers)
@@ -71,8 +72,8 @@ def tier_attach(mnode, volname, num_bricks_to_add, extra_servers,
mnode (str): Node on which cmd has to be executed.
volname (str): volume name
num_bricks_to_add (str): number of bricks to be added as hot tier
- extra_servers (list): from these servers, hot tier will be added
- to volume
+ extra_servers (str|list): from this server|these servers,
+ hot tier will be added to volume
extra_servers_info (dict): dict of server info of each extra servers
Kwargs:
@@ -96,6 +97,8 @@ def tier_attach(mnode, volname, num_bricks_to_add, extra_servers,
tier_attach("abc.com", testvol, '2', ['extra_server1','extra_server2'],
extra_server_info)
"""
+ if isinstance(extra_servers, str):
+ extra_servers = [extra_servers]
replica = int(replica)
repc = ''