Commit f04003e1 authored by Brenden Blanco's avatar Brenden Blanco

Merge pull request #126 from iovisor/yhs_dev

clean up potential conflict veth before creating new one in create_ns
parents 02bf6819 df73a828
......@@ -54,7 +54,7 @@ try:
for p in sim.processes: p.communicate(b"\n")
except:
if "sim" in locals():
for p in sim.processes: p.kill(); p.wait()
for p in sim.processes: p.kill(); p.wait(); p.release()
finally:
if "br-fabric" in ipdb.interfaces: ipdb.interfaces["br-fabric"].remove().commit()
if "sim" in locals(): sim.release()
......
import os
import subprocess
import pyroute2
from pyroute2 import IPRoute, NetNS, IPDB, NSPopen
......@@ -46,6 +47,10 @@ class Simulation(object):
# move half of veth into namespace
v.net_ns_fd = ns_ipdb.nl.netns
else:
# delete the potentially leaf-over veth interfaces
ipr = IPRoute()
for i in ipr.link_lookup(ifname='%sa' % ifc_base_name): ipr.link_remove(i)
ipr.close()
try:
out_ifc = self.ipdb.create(ifname="%sa" % ifc_base_name, kind="veth",
peer="%sb" % ifc_base_name).commit()
......
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