summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster
diff options
context:
space:
mode:
authorkshithijiyer <kshithij.ki@gmail.com>2020-04-21 15:22:39 +0530
committerBala Konda Reddy M <bala12352@gmail.com>2020-04-21 13:03:21 +0000
commita493ce9eb3df82e48d6bbb7738ae3ae8aa26242c (patch)
treec4fdb91e1f3db11ac30a62fcde23136ed94878c8 /glustolibs-gluster/glustolibs/gluster
parent5d9a0ab8e46475af390272a0916e9f075153ca4b (diff)
[Libfix] Add brick sharing spt to replace_brick_from_volume()
Problem: `replace_brick_from_volume()` function doesn't support brick shareing which creates a problem as when we try to perform replace brick with a large number of volumes it is unable to get bricks and hence failes. Solution: Adding code for boolean kawrg for multi_vol and using form_bricks_for_multivol() or form_bricks_list() according to the value of multi_vol. The default value of multi_vol is false which would only use form_bricks_list() as done without the changes. Blocks: This patch currently blocks the below mentioned patch: https://review.gluster.org/#/c/glusto-tests/+/19483/ Change-Id: I842a4ebea81e53e694b5b194294f1b941f47d380 Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/volume_libs.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/volume_libs.py b/glustolibs-gluster/glustolibs/gluster/volume_libs.py
index a5e5410..6e6defb 100644
--- a/glustolibs-gluster/glustolibs/gluster/volume_libs.py
+++ b/glustolibs-gluster/glustolibs/gluster/volume_libs.py
@@ -1897,7 +1897,8 @@ def form_bricks_to_replace_brick(mnode, volname, servers, all_servers_info,
def replace_brick_from_volume(mnode, volname, servers, all_servers_info,
src_brick=None, dst_brick=None,
delete_brick=True,
- replace_brick_from_hot_tier=False):
+ replace_brick_from_hot_tier=False,
+ multi_vol=False):
"""Replace faulty brick from the volume.
Args:
@@ -1929,6 +1930,10 @@ def replace_brick_from_volume(mnode, volname, servers, all_servers_info,
replace_brick_from_hot_tier (bool): True If brick are to be
replaced from hot_tier. False otherwise. Defaults to False.
+ multi_vol (bool): True, If bricks need to created for multiple
+ volumes(more than 5)
+ False, Otherwise. By default, value is set to False.
+
Returns:
bool: True if replacing brick from the volume is successful.
False otherwise.
@@ -1945,10 +1950,17 @@ def replace_brick_from_volume(mnode, volname, servers, all_servers_info,
subvols_info = get_subvols(mnode, volname)
if not dst_brick:
- dst_brick = form_bricks_list(mnode=mnode, volname=volname,
- number_of_bricks=1,
- servers=servers,
- servers_info=all_servers_info)
+ if multi_vol:
+ dst_brick = form_bricks_for_multivol(mnode=mnode,
+ volname=volname,
+ number_of_bricks=1,
+ servers=servers,
+ servers_info=all_servers_info)
+ else:
+ dst_brick = form_bricks_list(mnode=mnode, volname=volname,
+ number_of_bricks=1,
+ servers=servers,
+ servers_info=all_servers_info)
if not dst_brick:
g.log.error("Failed to get a new brick to replace the faulty "
"brick")