From cfc9578148985f117c230be263d9faab4c1bb57e Mon Sep 17 00:00:00 2001 From: Assaf Muller Date: Mon, 7 Dec 2015 17:36:06 -0500 Subject: [PATCH] Don't emit confusing error in netns-cleanup 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 --- neutron/cmd/netns_cleanup.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/neutron/cmd/netns_cleanup.py b/neutron/cmd/netns_cleanup.py index 0c53ded682d..3d59ef99ded 100644 --- a/neutron/cmd/netns_cleanup.py +++ b/neutron/cmd/netns_cleanup.py @@ -112,9 +112,12 @@ def eligible_for_deletion(conf, namespace, force=False): 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) @@ -123,6 +126,8 @@ def unplug_device(conf, device): 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):