From: Claudio-Daniel Freire Date: Fri, 1 Jul 2011 12:41:26 +0000 (+0200) Subject: Use a lockfile for vsys serialization, not the vsys pipes (they don't work) X-Git-Tag: nepi_v2_1~8 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=53ee66f307dd0eec554ff4306615bf365cb18d9c;p=nepi.git Use a lockfile for vsys serialization, not the vsys pipes (they don't work) --- diff --git a/src/nepi/testbeds/planetlab/scripts/tun_connect.py b/src/nepi/testbeds/planetlab/scripts/tun_connect.py index e0f0d831..98e53339 100644 --- a/src/nepi/testbeds/planetlab/scripts/tun_connect.py +++ b/src/nepi/testbeds/planetlab/scripts/tun_connect.py @@ -287,10 +287,11 @@ def pl_vif_start(tun_path, tun_name): out.append(stdout.read()) stdout.close() - stdin = open("/vsys/vif_up.in","w") - # Serialize access to vsys - lock = HostLock(stdin) + lockfile = open("/tmp/nepi-tun-connect.lock", "a") + lock = HostLock(lockfile) + + stdin = open("/vsys/vif_up.in","w") t = threading.Thread(target=outreader) t.start() @@ -310,6 +311,8 @@ def pl_vif_start(tun_path, tun_name): out = ''.join(out) if out.strip(): print >>sys.stderr, out + + del lock, lockfile def pl_vif_stop(tun_path, tun_name): out = [] @@ -318,10 +321,11 @@ def pl_vif_stop(tun_path, tun_name): out.append(stdout.read()) stdout.close() - stdin = open("/vsys/vif_down.in","w") - # Serialize access to vsys - lock = HostLock(stdin) + lockfile = open("/tmp/nepi-tun-connect.lock", "a") + lock = HostLock(lockfile) + + stdin = open("/vsys/vif_down.in","w") t = threading.Thread(target=outreader) t.start() @@ -333,6 +337,8 @@ def pl_vif_stop(tun_path, tun_name): out = ''.join(out) if out.strip(): print >>sys.stderr, out + + del lock, lockfile def tun_fwd(tun, remote):