Commit db97c896 authored by Peter V. Saveliev's avatar Peter V. Saveliev

ipdb: transaction timeout for the netns changes

Fix the hang-up while applying `net_ns_fd='/proc/self/ns/net'`

Bug-Url: https://github.com/svinota/pyroute2/issues/317
parent 85cbcd7c
......@@ -736,19 +736,20 @@ class Interface(Transactional):
# hardcoded pause -- if the interface was moved
# across network namespaces
if ('net_ns_fd' in request) or ('net_ns_pid' in request):
while True:
countdown = 10
while countdown:
# wait until the interface will disappear
# from the main network namespace
# from the current network namespace
try:
for link in self.nl.get_links(self['index']):
self.ipdb.interfaces._new(link)
self.nl.get_links(self['index'])
except NetlinkError as e:
if e.code == errno.ENODEV:
break
raise
except Exception:
raise
time.sleep(0.1)
countdown -= 1
time.sleep(0.1)
if not transaction.partial:
transaction.wait_all_targets()
......
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