Commit b67b607b authored by Wei-Chun Chao's avatar Wei-Chun Chao

release IPDB in host ns early

We need it for setting vxlan flow based flags currently. Release
it once the interfaces are set up. This does not help Ctrl-C on
main.py though.
Signed-off-by: default avatarWei-Chun Chao <weichunc@plumgrid.com>
parent 3ba6ad87
...@@ -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