Hi,
I am trying to create different namespaces (e.g: namespace1, namespace2 etc..) using pyroute2 functionality.
Script is crashing during commit operation while adding veth interface of root namespace to bridge (br0).
Sporadically run time error is seen. May i know what may be the causes for the run time errors during commit operation.
Also, for every commit operation, it is required to give sleep time of 0.1, how to avoid this sleep time. Any suggestions.
Steps:
- Create namespaces.
- Create virtual ethernet device pairs for all namespaces.
- Assign one side of the veth pair to the namespace.
- Assign IP addresses to each side of the veth pair.
- Set the default route for our namespace.
- Attach the other side of the veth pair to a bridge. >> Crash is seen sporadically while doing br.commit() operation.
#issue 1
---------------
if bridge_name is not None:
br=iproot.interfaces.get(bridge_name)
br.add_port(veth_interface)
br.commit() ------> CRASH
time.sleep(0.1)
One more important thing: #issue 2
interface_link.commit()
time.sleep(0.1) ----------------> For Every commit i need to give sleep time other wise it is crashing.
How to avoid this sleep time for every commit operation
------------------------------------------------------
Trace is showing as:
br.commit()
File "/usr/lib/python2.7/site-packages/pyroute2/ipdb/interface.py", in commit
raise error
RuntimeError
Interface.py
------------------
# something went wrong: roll the transaction back
if commit_phase == 1:
if newif:
drop = False
try:
self.commit(transaction=init if newif else snapshot,
commit_phase=2,
commit_mask=commit_mask,
newif=newif)
except Exception as i_e:
debug['next_stage'] = i_e
error = RuntimeError()