diff options
author | Arthy Loganathan <aloganat@redhat.com> | 2016-06-27 17:44:28 +0530 |
---|---|---|
committer | M S Vishwanath Bhat <msvbhat@gmail.com> | 2016-06-28 07:06:51 -0700 |
commit | 5205d42ddfb67e22eab7fa54ac9b081bb1f8b1ec (patch) | |
tree | 9ae809d011b837b3a52932ee0bb2167511d6f640 | |
parent | 763ed1017b0011934ad2414d7396c46e528ea5b3 (diff) |
distaf: Modified tier_attach() to get bricks path from available
bricks in server
Added code to get bricks path from available bricks in
server in tier_attach()
Change-Id: I58822f425c6ea8284568d3701807cfcc11f37e3c
BUG: 1350427
Signed-off-by: Arthy Loganathan <aloganat@redhat.com>
Reviewed-on: http://review.gluster.org/14814
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: M S Vishwanath Bhat <msvbhat@gmail.com>
-rw-r--r-- | tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/tiering_ops.py | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/tiering_ops.py b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/tiering_ops.py index 96557f9af15..4074fb7c634 100644 --- a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/tiering_ops.py +++ b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/tiering_ops.py @@ -114,30 +114,22 @@ def tier_attach(volname, num_bricks_to_add, peers, replica=1, force=False, if force: frce = 'force' - # To Do - # For now, assuming brick root path is /bricks in all the servers. - # Later on, this will be made configurable - - brick_root = "/bricks" - volinfo = distaflibs.gluster.volume_ops.get_volume_info(volname, mnode) - bricks_present = volinfo[volname]['bricks'] - _n = 0 - _temp = 0 - _si = len(re.findall(r"%s_tier[0-9]+" % volname, ' '.join(bricks_present))) - add_tier = '' - for i in range(_si, _si + int(num_bricks_to_add)): - sn = (len(re.findall(r"%s" % peers[_n], ' '.join(bricks_present))) + - _temp) - add_tier = ("%s %s:%s/brick%d/%s_tier%d" % - (add_tier, peers[_n], brick_root, sn, volname, i)) - if _n < len(peers) - 1: - _n = _n + 1 - else: - _n = 0 - _temp = _temp + 1 - + num_bricks_to_add = int(num_bricks_to_add) + + from distaflibs.gluster.lib_utils import form_bricks_path + bricks_path = form_bricks_path(num_bricks_to_add, peers[:], + mnode, volname) + if bricks_path is None: + tc.logger.error("number of bricks required are greater than " + "unused bricks") + return (-1, '', '') + + bricks_path = [re.sub(r"(.*\/\S+\_)brick(\d+)", r"\1tier\2", item) + for item in bricks_path.split() if item] + tier_bricks_path = " ".join(bricks_path) cmd = ("gluster volume tier %s attach %s %s %s --mode=script" - % (volname, repc, add_tier, frce)) + % (volname, repc, tier_bricks_path, frce)) + return tc.run(mnode, cmd) |