1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

addons: vlan: check vlan-id misconfiguration and print warning

patch adds the following warning when it detects a vlan-id misconfiguration
error: vlan13: cannot change vlan-id to 13: operation not supported. Please delete the device with 'ifdown vlan13' and recreate it to apply the change.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
This commit is contained in:
Julien Fortin
2020-12-12 01:20:57 +01:00
committed by Julien Fortin
parent 75a9503027
commit 9c1176c849

View File

@ -159,6 +159,13 @@ class vlan(Addon, moduleBase):
'apply the change.'
% (ifaceobj.name, vlan_protocol, ifaceobj.name))
cached_vlan_id = cached_vlan_ifla_info_data.get(Link.IFLA_VLAN_ID)
if cached_vlan_id is not None and vlanid != cached_vlan_id:
raise Exception('%s: cannot change vlan-id to %s: operation not supported. '
'Please delete the device with \'ifdown %s\' and recreate it to '
'apply the change.'
% (ifaceobj.name, vlanid, ifaceobj.name))
if not ifupdownflags.flags.PERFMODE:
vlan_exists = self.cache.link_exists(ifaceobj.name)