From e2a652ca6ba56235e6d64bf7df110afdc5f6ca27 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Fri, 17 Mar 2017 13:03:57 -0400 Subject: 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 :: \ config access_mount true The default value of 'access_mount' is false. Change-Id: I53dce4ea86a6ffc979c82f9330e8954327180ca3 BUG: 1433506 Signed-off-by: Kotresh HR Reviewed-on: https://review.gluster.org/16912 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Vijay Bellur --- geo-replication/syncdaemon/syncdutils.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'geo-replication/syncdaemon/syncdutils.py') 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 -- cgit