summaryrefslogtreecommitdiffstats
path: root/geo-replication/syncdaemon/syncdutils.py
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2017-03-17 13:03:57 -0400
committerVijay Bellur <vbellur@redhat.com>2017-03-19 23:33:36 -0400
commite2a652ca6ba56235e6d64bf7df110afdc5f6ca27 (patch)
tree543703ded623cca89254a9b2ecc5ba03785e8f52 /geo-replication/syncdaemon/syncdutils.py
parent78222bff29f27fc3b4f500ff2f7bd323c418d09e (diff)
geo-rep: Optionally allow access to mounts
In order to improve debuggability, it is important to have access to geo-rep master and slave mounts. With the default behaviour, geo-rep lazy unmounts the mounts after changing the current working directory into the mount point. It also cleans up the mount points. So only geo-rep worker has the access and it becomes impossible to take the client profile info and do any other client statck analysis. Hence the following new config is being introduced to allow access to mounts. gluster vol geo-rep <mastervol> <slavehost>::<slavevol> \ config access_mount true The default value of 'access_mount' is false. Change-Id: I53dce4ea86a6ffc979c82f9330e8954327180ca3 BUG: 1433506 Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: https://review.gluster.org/16912 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'geo-replication/syncdaemon/syncdutils.py')
-rw-r--r--geo-replication/syncdaemon/syncdutils.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/geo-replication/syncdaemon/syncdutils.py b/geo-replication/syncdaemon/syncdutils.py
index 292cd0aea19..4d981f9fe53 100644
--- a/geo-replication/syncdaemon/syncdutils.py
+++ b/geo-replication/syncdaemon/syncdutils.py
@@ -16,6 +16,7 @@ import fcntl
import shutil
import logging
import socket
+import subprocess
from threading import Lock, Thread as baseThread
from errno import EACCES, EAGAIN, EPIPE, ENOTCONN, ECONNABORTED
from errno import EINTR, ENOENT, EPERM, ESTALE, errorcode
@@ -189,12 +190,13 @@ def grabpidfile(fname=None, setpid=True):
final_lock = Lock()
-
+mntpt_list = []
def finalize(*a, **kw):
"""all those messy final steps we go trough upon termination
Do away with pidfile, ssh control dir and logging.
"""
+
final_lock.acquire()
if getattr(gconf, 'pid_file', None):
rm_pidf = gconf.pid_file_owned
@@ -234,6 +236,13 @@ def finalize(*a, **kw):
if sys.exc_info()[0] == OSError:
pass
+ """ Unmount if not done """
+ for mnt in mntpt_list:
+ p0 = subprocess.Popen (["umount", "-l", mnt], stderr=subprocess.PIPE)
+ _, errdata = p0.communicate()
+ if p0.returncode == 0:
+ os.rmdir(mnt)
+
if gconf.log_exit:
logging.info("exiting.")
sys.stdout.flush()
@@ -241,6 +250,7 @@ def finalize(*a, **kw):
os._exit(kw.get('exval', 0))
+
def log_raise_exception(excont):
"""top-level exception handler