From bd451a48465b37659aaeb6f0fe701b8e35d910df Mon Sep 17 00:00:00 2001 From: Julien Fortin Date: Wed, 27 Feb 2019 22:40:55 +0100 Subject: [PATCH] addons: addressvirtual: vrrp: remove macvlan device when all ipvX addrs are removed 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 --- ifupdown2/addons/addressvirtual.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ifupdown2/addons/addressvirtual.py b/ifupdown2/addons/addressvirtual.py index 7a2eb00..b031f2a 100644 --- a/ifupdown2/addons/addressvirtual.py +++ b/ifupdown2/addons/addressvirtual.py @@ -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 -- 2.39.2