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