Skip to content

Commit 1d2a1c6

Browse files
committed
Retry set|get_link_attribute(s) if the interface is not present
After some interface operations (in particular the ``IpLinkCommand.set_ns`` operation), the network interface is temporarily not present in the destination namespace. This patch retries the interface "ip link set|show" command in that case. Related-Bug: #1961740 Change-Id: I5a57cfc71ad59f1fe9ea65e19b1a32314d798729 (cherry picked from commit 016f518)
1 parent 93cf601 commit 1d2a1c6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

neutron/privileged/agent/linux/ip_lib.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,10 @@ def set_link_flags(device, namespace, flags):
400400
_run_iproute_link("set", device, namespace, flags=new_flags)
401401

402402

403+
@tenacity.retry(
404+
retry=tenacity.retry_if_exception_type(NetworkInterfaceNotFound),
405+
wait=tenacity.wait_exponential(multiplier=0.02, max=1),
406+
stop=tenacity.stop_after_delay(3), reraise=True)
403407
@privileged.link_cmd.entrypoint
404408
def set_link_attribute(device, namespace, **attributes):
405409
_run_iproute_link("set", device, namespace, **attributes)
@@ -430,7 +434,8 @@ def set_link_bridge_master(device, bridge, namespace=None):
430434

431435
@tenacity.retry(
432436
retry=tenacity.retry_if_exception_type(
433-
netlink_exceptions.NetlinkDumpInterrupted),
437+
(netlink_exceptions.NetlinkDumpInterrupted,
438+
NetworkInterfaceNotFound)),
434439
wait=tenacity.wait_exponential(multiplier=0.02, max=1),
435440
stop=tenacity.stop_after_delay(8),
436441
reraise=True)

0 commit comments

Comments
 (0)