diff options
author | Sunny Kumar <sunkumar@redhat.com> | 2019-06-20 18:47:45 +0530 |
---|---|---|
committer | Kotresh HR <khiremat@redhat.com> | 2019-11-06 22:29:14 +0530 |
commit | d82acea433d6defd0b9bd084a43c0b7b30fd171d (patch) | |
tree | 4bc0e2a2c1529810dda06d2eedc32339ff068254 | |
parent | 60eba49c6290d6f387986fdb41d37c613ad766b6 (diff) |
geo-rep : fix gluster command path for non-root session
Problem:
gluster command not found.
Cause:
In Volinfo class we issue command 'gluster vol info' to get information
about volume like getting brick_root to perform various operation.
When geo-rep session is configured for non-root user Volinfo class
fails to issue gluster command due to unavailability of gluster
binary path for non-root user.
Solution:
Use config value 'slave-gluster-command-dir'/'gluster-command-dir' to get path
for gluster command based on caller.
Backport of:
> Patch: https://review.gluster.org/22920
> BUG: 1722740
> Change-Id: I4ec46373da01f5d00ecd160c4e8c6239da8b3859
> Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
fixes: bz#1764007
Change-Id: I4ec46373da01f5d00ecd160c4e8c6239da8b3859
Signed-off-by: Kotresh HR <khiremat@redhat.com>
-rw-r--r-- | geo-replication/syncdaemon/monitor.py | 4 | ||||
-rw-r--r-- | geo-replication/syncdaemon/syncdutils.py | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/geo-replication/syncdaemon/monitor.py b/geo-replication/syncdaemon/monitor.py index 296e598b8a9..236afe70d11 100644 --- a/geo-replication/syncdaemon/monitor.py +++ b/geo-replication/syncdaemon/monitor.py @@ -371,7 +371,7 @@ def distribute(master, slave): if rconf.args.use_gconf_volinfo: mvol = VolinfoFromGconf(master.volume, master=True) else: - mvol = Volinfo(master.volume, master.host) + mvol = Volinfo(master.volume, master.host, master=True) logging.debug('master bricks: ' + repr(mvol.bricks)) prelude = [] slave_host = None @@ -387,7 +387,7 @@ def distribute(master, slave): if rconf.args.use_gconf_volinfo: svol = VolinfoFromGconf(slave.volume, master=False) else: - svol = Volinfo(slave.volume, "localhost", prelude) + svol = Volinfo(slave.volume, "localhost", prelude, master=False) sbricks = svol.bricks suuid = svol.uuid diff --git a/geo-replication/syncdaemon/syncdutils.py b/geo-replication/syncdaemon/syncdutils.py index d886dd7a9ce..aadaebd405d 100644 --- a/geo-replication/syncdaemon/syncdutils.py +++ b/geo-replication/syncdaemon/syncdutils.py @@ -672,7 +672,7 @@ def get_slv_dir_path(slv_host, slv_volume, gfid): dir_path = ENOENT if not slv_bricks: - slv_info = Volinfo(slv_volume, slv_host) + slv_info = Volinfo(slv_volume, slv_host, master=False) slv_bricks = slv_info.bricks # Result of readlink would be of format as below. # readlink = "../../pgfid[0:2]/pgfid[2:4]/pgfid/basename" @@ -854,8 +854,14 @@ class Popen(subprocess.Popen): class Volinfo(object): - def __init__(self, vol, host='localhost', prelude=[]): - po = Popen(prelude + ['gluster', '--xml', '--remote-host=' + host, + def __init__(self, vol, host='localhost', prelude=[], master=True): + if master: + gluster_cmd_dir = gconf.get("gluster-command-dir") + else: + gluster_cmd_dir = gconf.get("slave-gluster-command-dir") + + gluster_cmd = os.path.join(gluster_cmd_dir, 'gluster') + po = Popen(prelude + [gluster_cmd, '--xml', '--remote-host=' + host, 'volume', 'info', vol], stdout=PIPE, stderr=PIPE, universal_newlines=True) vix = po.stdout.read() |