summaryrefslogtreecommitdiffstats
path: root/geo-replication/syncdaemon/monitor.py
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2018-06-07 04:11:25 -0400
committerKotresh HR <khiremat@redhat.com>2018-08-16 00:20:47 -0400
commit050969fb3cfb176fa206d3ae8169d6021879d9db (patch)
tree96b6b37b145611e9b788440ba2c0364615c0a05f /geo-replication/syncdaemon/monitor.py
parent03aed04ac00e7985c7891a532d7c59a0a4c547ed (diff)
geo-rep: Fix geo-rep for older versions of unshare
Geo-rep mounts are private to worker. It uses mount namespace using unshare command to achieve the same. Well, the unshare command has to support '--propagation' option. So geo-rep breaks on the systems with older unshare version. The patch makes it fall back to lazy umount behaviour if the unshare does not support propagation option. Backport of: > BUG: 1589782 > Change-Id: Ia614f068aede288d63ac62fea4461b1865066054 > Signed-off-by: Kotresh HR <khiremat@redhat.com> fixes: bz#1611111 Change-Id: Ia614f068aede288d63ac62fea4461b1865066054 Signed-off-by: Kotresh HR <khiremat@redhat.com>
Diffstat (limited to 'geo-replication/syncdaemon/monitor.py')
-rw-r--r--geo-replication/syncdaemon/monitor.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/geo-replication/syncdaemon/monitor.py b/geo-replication/syncdaemon/monitor.py
index 0d1423aca9f..40818427bfe 100644
--- a/geo-replication/syncdaemon/monitor.py
+++ b/geo-replication/syncdaemon/monitor.py
@@ -26,7 +26,7 @@ from syncdutils import set_term_handler, GsyncdError
from syncdutils import Thread, finalize, Volinfo, VolinfoFromGconf
from syncdutils import gf_event, EVENT_GEOREP_FAULTY, get_up_nodes
from gsyncdstatus import GeorepStatus, set_monitor_status
-
+from syncdutils import unshare_propagation_supported
ParseError = XET.ParseError if hasattr(XET, 'ParseError') else SyntaxError
@@ -225,9 +225,16 @@ class Monitor(object):
if access_mount:
os.execv(sys.executable, args_to_worker)
else:
- unshare_cmd = ['unshare', '-m', '--propagation', 'private']
- cmd = unshare_cmd + args_to_worker
- os.execvp("unshare", cmd)
+ if unshare_propagation_supported():
+ logging.debug("Worker would mount volume privately")
+ unshare_cmd = ['unshare', '-m', '--propagation',
+ 'private']
+ cmd = unshare_cmd + args_to_worker
+ os.execvp("unshare", cmd)
+ else:
+ logging.debug("Mount is not private. It would be lazy"
+ " umounted")
+ os.execv(sys.executable, args_to_worker)
cpids.add(cpid)
agents.add(apid)