Skip to content

Commit

Permalink
Merge pull request iovisor#114 from iovisor/weichunc_dev
Browse files Browse the repository at this point in the history
release IPDB in host ns early
  • Loading branch information
drzaeus77 committed Aug 4, 2015
2 parents 3ba6ad8 + b67b607 commit b3d5864
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions examples/distributed_bridge/tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from pyroute2 import IPRoute, NetNS, IPDB, NSPopen
from socket import htons, AF_INET
from threading import Thread
from subprocess import call

host_id = int(argv[1])

Expand Down Expand Up @@ -68,11 +69,11 @@ def run():

try:
run()
ipdb.release()
input("")
print("---")
for k, v in mac2host.items():
print(EUI(k.mac), k.ifindex, IPAddress(v.remote_ipv4),
v.tunnel_id, v.rx_pkts, v.tx_pkts)
finally:
for v in ifc_gc: ipdb.interfaces[v].remove().commit()
ipdb.release()
for v in ifc_gc: call(["ip", "link", "del", v])
5 changes: 3 additions & 2 deletions examples/distributed_bridge/tunnel_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from pyroute2 import IPRoute, NetNS, IPDB, NSPopen
from socket import htons, AF_INET
from threading import Thread
from subprocess import call

num_hosts = int(argv[1])
host_id = int(argv[2])
Expand Down Expand Up @@ -73,8 +74,8 @@ def run():

try:
run()
ipdb.release()
input("")
print("---")
finally:
for v in ifc_gc: ipdb.interfaces[v].remove().commit()
ipdb.release()
for v in ifc_gc: call(["ip", "link", "del", v])

0 comments on commit b3d5864

Please sign in to comment.