Fix error message on VLAN ID conflict

If VLAN ID conflict happens on CNI ADD, we don't have the vif to figure
the VLAN ID from, so the error message returned to CRI would fail. This
commit fixes this.

Change-Id: I70fa5045cbb4efaf45ca835555231bda17182be1
This commit is contained in:
Michał Dulko 2022-01-25 14:29:58 +01:00
parent 9939f51132
commit 274c08b71f

View File

@ -114,16 +114,13 @@ class DaemonServer(object):
except pyroute2.NetlinkError as e:
if e.code == errno.EEXIST:
self._check_failure()
args = {'kind': 'vlan', 'vlan_id': vif.vlan_id}
LOG.warning(
f'Creation of pod interface failed due to VLAN ID '
f'(vlan_info={args}) conflict. Probably the CRI had not '
f'cleaned up the network namespace of deleted pods. '
f'Attempting to retry.')
f'conflict. Probably the CRI had not cleaned up the '
f'network namespace of deleted pods. Attempting to retry.')
error = self._error(ErrTryAgainLater,
"Creation of pod interface failed due to"
" vlan_id. Try Again Later",
f"vlan_id:{vif.vlan_id}")
"Creation of pod interface failed due to "
"VLAN ID conflict. Try Again Later")
return error, httplib.GATEWAY_TIMEOUT, self.headers
raise
except Exception: