If we're trying to delete a dhcp/qrouter device with use_veth
= False (Which is the default for some time), we'll first
try to 'ip link del %s', which will fail and emit a confusing
error, then try 'ovs-vsctl del-port'. There's no need to
log an error in such a case.
The patch attempts to future proof by setting the
set_log_fail_as_error(False) to be as tight as possible, so we
do log errors in case the device is somehow used in the future.
Change-Id: I1954bde3ee9a2e43d7615717134b61c5fa7cfbb1
Closes-Bug: #
1463800
def unplug_device(conf, device):
+ orig_log_fail_as_error = device.get_log_fail_as_error()
+ device.set_log_fail_as_error(False)
try:
device.link.delete()
except RuntimeError:
+ device.set_log_fail_as_error(orig_log_fail_as_error)
# Maybe the device is OVS port, so try to delete
ovs = ovs_lib.BaseOVS()
bridge_name = ovs.get_bridge_for_iface(device.name)
bridge.delete_port(device.name)
else:
LOG.debug('Unable to find bridge for device: %s', device.name)
+ finally:
+ device.set_log_fail_as_error(orig_log_fail_as_error)
def destroy_namespace(conf, namespace, force=False):