f338ef
From 1c55f3633f748629cd0484f79b6c49101eb2df82 Mon Sep 17 00:00:00 2001
f338ef
From: Sunny Kumar <sunkumar@redhat.com>
f338ef
Date: Mon, 8 Jul 2019 11:47:28 +0530
f338ef
Subject: [PATCH 226/255] geo-rep : fix gluster command path for non-root
f338ef
 session
f338ef
f338ef
Problem:
f338ef
gluster command not found.
f338ef
f338ef
Cause:
f338ef
In Volinfo class we issue command 'gluster vol info' to get information
f338ef
about volume like getting brick_root to perform various operation.
f338ef
When geo-rep session is configured for non-root user Volinfo class
f338ef
fails to issue gluster command due to unavailability of gluster
f338ef
binary path for non-root user.
f338ef
f338ef
Solution:
f338ef
Use config value 'slave-gluster-command-dir'/'gluster-command-dir' to get path
f338ef
for gluster command based on caller.
f338ef
f338ef
>Backport of:
f338ef
>Upstream Patch: https://review.gluster.org/#/c/glusterfs/+/22920/.
f338ef
>fixes: bz#1722740
f338ef
>Change-Id: I4ec46373da01f5d00ecd160c4e8c6239da8b3859
f338ef
>Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
f338ef
f338ef
BUG: 1712591
f338ef
Change-Id: Ifea2927253a9521fa459fea6de8a60085c3413f6
f338ef
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
f338ef
Reviewed-on: https://code.engineering.redhat.com/gerrit/175485
f338ef
Tested-by: RHGS Build Bot <nigelb@redhat.com>
f338ef
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
f338ef
---
f338ef
 geo-replication/syncdaemon/monitor.py    |  4 ++--
f338ef
 geo-replication/syncdaemon/syncdutils.py | 12 +++++++++---
f338ef
 2 files changed, 11 insertions(+), 5 deletions(-)
f338ef
f338ef
diff --git a/geo-replication/syncdaemon/monitor.py b/geo-replication/syncdaemon/monitor.py
f338ef
index c45ef24..234f3f1 100644
f338ef
--- a/geo-replication/syncdaemon/monitor.py
f338ef
+++ b/geo-replication/syncdaemon/monitor.py
f338ef
@@ -369,7 +369,7 @@ def distribute(master, slave):
f338ef
     if rconf.args.use_gconf_volinfo:
f338ef
         mvol = VolinfoFromGconf(master.volume, master=True)
f338ef
     else:
f338ef
-        mvol = Volinfo(master.volume, master.host)
f338ef
+        mvol = Volinfo(master.volume, master.host, master=True)
f338ef
     logging.debug('master bricks: ' + repr(mvol.bricks))
f338ef
     prelude = []
f338ef
     slave_host = None
f338ef
@@ -385,7 +385,7 @@ def distribute(master, slave):
f338ef
     if rconf.args.use_gconf_volinfo:
f338ef
         svol = VolinfoFromGconf(slave.volume, master=False)
f338ef
     else:
f338ef
-        svol = Volinfo(slave.volume, "localhost", prelude)
f338ef
+        svol = Volinfo(slave.volume, "localhost", prelude, master=False)
f338ef
 
f338ef
     sbricks = svol.bricks
f338ef
     suuid = svol.uuid
f338ef
diff --git a/geo-replication/syncdaemon/syncdutils.py b/geo-replication/syncdaemon/syncdutils.py
f338ef
index 3f41b5f..2ee10ac 100644
f338ef
--- a/geo-replication/syncdaemon/syncdutils.py
f338ef
+++ b/geo-replication/syncdaemon/syncdutils.py
f338ef
@@ -672,7 +672,7 @@ def get_slv_dir_path(slv_host, slv_volume, gfid):
f338ef
     dir_path = ENOENT
f338ef
 
f338ef
     if not slv_bricks:
f338ef
-        slv_info = Volinfo(slv_volume, slv_host)
f338ef
+        slv_info = Volinfo(slv_volume, slv_host, master=False)
f338ef
         slv_bricks = slv_info.bricks
f338ef
     # Result of readlink would be of format as below.
f338ef
     # readlink = "../../pgfid[0:2]/pgfid[2:4]/pgfid/basename"
f338ef
@@ -854,8 +854,14 @@ class Popen(subprocess.Popen):
f338ef
 
f338ef
 class Volinfo(object):
f338ef
 
f338ef
-    def __init__(self, vol, host='localhost', prelude=[]):
f338ef
-        po = Popen(prelude + ['gluster', '--xml', '--remote-host=' + host,
f338ef
+    def __init__(self, vol, host='localhost', prelude=[], master=True):
f338ef
+        if master:
f338ef
+            gluster_cmd_dir = gconf.get("gluster-command-dir")
f338ef
+        else:
f338ef
+            gluster_cmd_dir = gconf.get("slave-gluster-command-dir")
f338ef
+
f338ef
+        gluster_cmd = os.path.join(gluster_cmd_dir, 'gluster')
f338ef
+        po = Popen(prelude + [gluster_cmd, '--xml', '--remote-host=' + host,
f338ef
                               'volume', 'info', vol],
f338ef
                    stdout=PIPE, stderr=PIPE, universal_newlines=True)
f338ef
         vix = po.stdout.read()
f338ef
-- 
f338ef
1.8.3.1
f338ef