summaryrefslogtreecommitdiffstats
path: root/geo-replication/syncdaemon/monitor.py
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2018-09-24 20:56:21 +0530
committerAmar Tumballi <amarts@redhat.com>2018-09-25 17:03:21 +0000
commit173e89a6506bc8c727ce6d8e5ac84b59ad2e21de (patch)
tree1ea0c403579f17c03a595ca1bda1c28d8e0c05b4 /geo-replication/syncdaemon/monitor.py
parent8f207feb260bc6112d5085859b43efc8378a4c5f (diff)
georep: Fix python3 compatibility (os.pipe)
'os.pipe' returns pair of file descriptors which are non-inheritable by child processes. But geo-rep uses te inheritable nature of pipe fds to communicate between parent and child processes. Hence wrote a compatiable pipe routine which works well both with python2 and python3 with inheritable nature. Updates: #411 Change-Id: I869d7a52eeecdecf3851d44ed400e69b32a612d9 Signed-off-by: Kotresh HR <khiremat@redhat.com>
Diffstat (limited to 'geo-replication/syncdaemon/monitor.py')
-rw-r--r--geo-replication/syncdaemon/monitor.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/geo-replication/syncdaemon/monitor.py b/geo-replication/syncdaemon/monitor.py
index 97274f32422..ca2839059a3 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
+from syncdutils import unshare_propagation_supported, pipe
ParseError = XET.ParseError if hasattr(XET, 'ParseError') else SyntaxError
@@ -158,9 +158,9 @@ class Monitor(object):
# worker and changelog agent.
# read/write end for agent
- (ra, ww) = os.pipe()
+ (ra, ww) = pipe()
# read/write end for worker
- (rw, wa) = os.pipe()
+ (rw, wa) = pipe()
# spawn the agent process
apid = os.fork()
@@ -186,7 +186,7 @@ class Monitor(object):
os.execv(sys.executable, args_to_agent)
- pr, pw = os.pipe()
+ pr, pw = pipe()
cpid = os.fork()
if cpid == 0:
os.close(pr)
@@ -438,7 +438,7 @@ def startup(go_daemon=True):
if not go_daemon:
return
- x, y = os.pipe()
+ x, y = pipe()
cpid = os.fork()
if cpid:
os.close(x)