summaryrefslogtreecommitdiffstats
path: root/geo-replication/syncdaemon
diff options
context:
space:
mode:
Diffstat (limited to 'geo-replication/syncdaemon')
-rw-r--r--geo-replication/syncdaemon/monitor.py10
-rw-r--r--geo-replication/syncdaemon/resource.py4
-rw-r--r--geo-replication/syncdaemon/syncdutils.py12
3 files changed, 19 insertions, 7 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)
diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py
index e38027716b7..0c1b9818d2f 100644
--- a/geo-replication/syncdaemon/resource.py
+++ b/geo-replication/syncdaemon/resource.py
@@ -40,7 +40,7 @@ from syncdutils import GX_GFID_CANONICAL_LEN
from gsyncdstatus import GeorepStatus
from syncdutils import lf, Popen, sup
from syncdutils import Xattr, matching_disk_gfid, get_gfid_from_mnt
-from syncdutils import unshare_propagation_supported, get_slv_dir_path
+from syncdutils import unshare_propagation_supported, get_slv_dir_path, pipe
ENOTSUP = getattr(errno, 'ENOTSUP', 'EOPNOTSUPP')
@@ -858,7 +858,7 @@ class Mounter(object):
change into the mount, and lazy unmount the
filesystem.
"""
- mpi, mpo = os.pipe()
+ mpi, mpo = pipe()
mh = Popen.fork()
if mh:
# Parent
diff --git a/geo-replication/syncdaemon/syncdutils.py b/geo-replication/syncdaemon/syncdutils.py
index a17789995d8..d13c1c82853 100644
--- a/geo-replication/syncdaemon/syncdutils.py
+++ b/geo-replication/syncdaemon/syncdutils.py
@@ -1018,3 +1018,15 @@ def get_up_nodes(hosts, port):
up_nodes.append(h)
return up_nodes
+
+
+def pipe():
+ # Pipe routine for python2 and python3 compatiability
+ try:
+ (r, w) = os.pipe()
+ os.set_inheritable(r, True)
+ os.set_inheritable(w, True)
+ except AttributeError:
+ (r, w) = os.pipe()
+
+ return (r, w)