mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
addons: addressvirtual: delete macvlan when vrrp config is removed (ifreload case)
Add a vrrp config under swp intf - ifup, then remove the vrrp config - ifreload the macvlans are not removed without this patch Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
@@ -247,15 +247,19 @@ class addressvirtual(moduleBase):
|
||||
return
|
||||
hwaddress = []
|
||||
self.ipcmd.batch_start()
|
||||
macvlan_prefix = self._get_macvlan_prefix(ifaceobj)
|
||||
for macvlan_ifacename in glob.glob("/sys/class/net/%s*" %macvlan_prefix):
|
||||
macvlan_ifacename = os.path.basename(macvlan_ifacename)
|
||||
if not self.ipcmd.link_exists(macvlan_ifacename):
|
||||
continue
|
||||
hwaddress.append(self.ipcmd.link_get_hwaddress(macvlan_ifacename))
|
||||
self.ipcmd.link_delete(os.path.basename(macvlan_ifacename))
|
||||
# XXX: Also delete any fdb addresses. This requires, checking mac address
|
||||
# on individual macvlan interfaces and deleting the vlan from that.
|
||||
for macvlan_prefix in [
|
||||
self._get_macvlan_prefix(ifaceobj),
|
||||
self.get_vrr_prefix(ifaceobj.name, "4"),
|
||||
self.get_vrr_prefix(ifaceobj.name, "6")
|
||||
]:
|
||||
for macvlan_ifacename in glob.glob("/sys/class/net/%s*" % macvlan_prefix):
|
||||
macvlan_ifacename = os.path.basename(macvlan_ifacename)
|
||||
if not self.ipcmd.link_exists(macvlan_ifacename):
|
||||
continue
|
||||
hwaddress.append(self.ipcmd.link_get_hwaddress(macvlan_ifacename))
|
||||
self.ipcmd.link_delete(os.path.basename(macvlan_ifacename))
|
||||
# XXX: Also delete any fdb addresses. This requires, checking mac address
|
||||
# on individual macvlan interfaces and deleting the vlan from that.
|
||||
self.ipcmd.batch_commit()
|
||||
if any(hwaddress):
|
||||
self._remove_addresses_from_bridge(ifaceobj, hwaddress)
|
||||
|
Reference in New Issue
Block a user