diff options
author | ShwethaHP <spandura@redhat.com> | 2017-08-19 11:02:35 +0530 |
---|---|---|
committer | ShwethaHP <spandura@redhat.com> | 2017-08-19 11:08:21 +0530 |
commit | a8701fc8c8855429e9fc7da99dbe2b6b952802f2 (patch) | |
tree | 8eb636fdbc957b26ec60292e1b2273e9bf8fec67 | |
parent | 82a928a7fb408718db94df026b66e807eb554873 (diff) |
Fixing the BVT Issues:
1) self-heal failures: With the recent changes made to gluster for the bug: https://bugzilla.redhat.com/show_bug.cgi?id=1480423, the location of the brick process pid's changed to /var/run/gluster.
Making the corresponding changes to glusto-tests libraries.
Moving away from referring to pid file to grep for the process with the brick name.
This fixes the issue.
2) Group options not being set properly: Since we were popping the 'group' option from the 'options'
dictionary after the group options being set to set the other volume options, the option gets removed
from the g.config['gluster']['smb_volume_options'] as well.
Hence perform a deep copy of the dict before modifying the dict.
Change-Id: I293bf81913857cb0327f30aa1db5aaa9be5a318e
Signed-off-by: ShwethaHP <spandura@redhat.com>
-rw-r--r-- | glustolibs-gluster/glustolibs/gluster/brick_libs.py | 5 | ||||
-rw-r--r-- | glustolibs-gluster/glustolibs/gluster/volume_ops.py | 12 |
2 files changed, 10 insertions, 7 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/brick_libs.py b/glustolibs-gluster/glustolibs/gluster/brick_libs.py index ce23c442e..b4d232859 100644 --- a/glustolibs-gluster/glustolibs/gluster/brick_libs.py +++ b/glustolibs-gluster/glustolibs/gluster/brick_libs.py @@ -193,9 +193,10 @@ def bring_bricks_offline(volname, bricks_list, if bring_brick_offline_method == 'service_kill': brick_node, brick_path = brick.split(":") brick_path = brick_path.replace("/", "-") - kill_cmd = ("pid=`cat /var/lib/glusterd/vols/%s/run/%s%s.pid` && " + kill_cmd = ("pid=`ps -ef | grep -ve 'grep' | " + "grep -e '%s%s.pid' | awk '{print $2}'` && " "kill -15 $pid || kill -9 $pid" % - (volname, brick_node, brick_path)) + (brick_node, brick_path)) ret, _, _ = g.run(brick_node, kill_cmd) if ret != 0: g.log.error("Unable to kill the brick %s", brick) diff --git a/glustolibs-gluster/glustolibs/gluster/volume_ops.py b/glustolibs-gluster/glustolibs/gluster/volume_ops.py index 503f2c2f1..cc400390b 100644 --- a/glustolibs-gluster/glustolibs/gluster/volume_ops.py +++ b/glustolibs-gluster/glustolibs/gluster/volume_ops.py @@ -17,6 +17,7 @@ import re +import copy from glusto.core import Glusto as g from pprint import pformat try: @@ -540,9 +541,10 @@ def set_volume_options(mnode, volname, options): """ _rc = True + volume_options = copy.deepcopy(options) # Check if group options are specified. - if 'group' in options: - group_options = options.pop('group') + if 'group' in volume_options: + group_options = volume_options.pop('group') if isinstance(group_options, str): group_options = [group_options] for group_option in group_options: @@ -553,13 +555,13 @@ def set_volume_options(mnode, volname, options): g.log.error("Unable to set group option: %s", group_option) _rc = False - for option in options: + for option in volume_options: cmd = ("gluster volume set %s %s %s --mode=script" - % (volname, option, options[option])) + % (volname, option, volume_options[option])) ret, _, _ = g.run(mnode, cmd) if ret != 0: g.log.error("Unable to set value %s for option %s" - % (options[option], option)) + % (volume_options[option], option)) _rc = False return _rc |