]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
addons: addressvirtual: vrrp: remove macvlan device when all ipvX addrs are removed
authorJulien Fortin <julien@cumulusnetworks.com>
Wed, 27 Feb 2019 21:40:55 +0000 (22:40 +0100)
committerJulien Fortin <julien@cumulusnetworks.com>
Mon, 22 Apr 2019 02:50:42 +0000 (10:50 +0800)
For each VRRP configuration we create 2 macvlans (ip4 and ip6), if the ip4
is removed from the config we need to remove the associated macvlan (same
for ip6).

Testing Done: remove all ip4 (or ip6) from vrr attribute line

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
ifupdown2/addons/addressvirtual.py

index 7a2eb0049303d07da53d551a2a204ef1e5704195..b031f2a9e2df5d5cb426e4fe4682bd8c9f1addd5 100644 (file)
@@ -601,6 +601,11 @@ class addressvirtual(moduleBase):
                     "ips": ip4,
                     "id": vrrp_id
                 })
+            elif not ip4 and not ifquery:
+                # special check to see if all ipv4 were removed from the vrrp
+                # configuration, if so we need to remove the associated macvlan
+                if self.ipcmd.link_exists(macvlan_ip4_ifname):
+                    netlink.link_del(macvlan_ip4_ifname)
 
             if ip6 or ifquery:
                 # config_ip6
@@ -613,6 +618,11 @@ class addressvirtual(moduleBase):
                     "ips": ip6,
                     "id": vrrp_id
                 })
+            elif not ip6 and not ifquery:
+                # special check to see if all ipv6 were removed from the vrrp
+                # configuration, if so we need to remove the associated macvlan
+                if self.ipcmd.link_exists(macvlan_ip6_ifname):
+                    netlink.link_del(macvlan_ip6_ifname)
 
         return user_config_list