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