Commit b3d5864c authored by Brenden Blanco's avatar Brenden Blanco

Merge pull request #114 from iovisor/weichunc_dev

release IPDB in host ns early
parents 3ba6ad87 b67b607b
...@@ -12,6 +12,7 @@ from netaddr import EUI, IPAddress ...@@ -12,6 +12,7 @@ from netaddr import EUI, IPAddress
from pyroute2 import IPRoute, NetNS, IPDB, NSPopen from pyroute2 import IPRoute, NetNS, IPDB, NSPopen
from socket import htons, AF_INET from socket import htons, AF_INET
from threading import Thread from threading import Thread
from subprocess import call
host_id = int(argv[1]) host_id = int(argv[1])
...@@ -68,11 +69,11 @@ def run(): ...@@ -68,11 +69,11 @@ def run():
try: try:
run() run()
ipdb.release()
input("") input("")
print("---") print("---")
for k, v in mac2host.items(): for k, v in mac2host.items():
print(EUI(k.mac), k.ifindex, IPAddress(v.remote_ipv4), print(EUI(k.mac), k.ifindex, IPAddress(v.remote_ipv4),
v.tunnel_id, v.rx_pkts, v.tx_pkts) v.tunnel_id, v.rx_pkts, v.tx_pkts)
finally: finally:
for v in ifc_gc: ipdb.interfaces[v].remove().commit() for v in ifc_gc: call(["ip", "link", "del", v])
ipdb.release()
...@@ -12,6 +12,7 @@ from netaddr import EUI, IPAddress ...@@ -12,6 +12,7 @@ from netaddr import EUI, IPAddress
from pyroute2 import IPRoute, NetNS, IPDB, NSPopen from pyroute2 import IPRoute, NetNS, IPDB, NSPopen
from socket import htons, AF_INET from socket import htons, AF_INET
from threading import Thread from threading import Thread
from subprocess import call
num_hosts = int(argv[1]) num_hosts = int(argv[1])
host_id = int(argv[2]) host_id = int(argv[2])
...@@ -73,8 +74,8 @@ def run(): ...@@ -73,8 +74,8 @@ def run():
try: try:
run() run()
ipdb.release()
input("") input("")
print("---") print("---")
finally: finally:
for v in ifc_gc: ipdb.interfaces[v].remove().commit() for v in ifc_gc: call(["ip", "link", "del", v])
ipdb.release()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment