]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
addons: addressvirtual: delete macvlan when vrrp config is removed (ifreload case)
authorJulien Fortin <julien@cumulusnetworks.com>
Fri, 15 Feb 2019 10:29:43 +0000 (11:29 +0100)
committerJulien Fortin <julien@cumulusnetworks.com>
Mon, 22 Apr 2019 02:49:02 +0000 (10:49 +0800)
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>
ifupdown2/addons/addressvirtual.py

index 062c36188f1828865c742add1dfd5f0b76be4202..9e08e41e01866623e5b4cb20443ed8f120bec124 100644 (file)
@@ -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)