]> git.proxmox.com Git - mirror_ifupdown2.git/blobdiff - ifupdown2/ifupdownaddons/LinkUtils.py
addons: addressvirtual: keep macvlan down if link-down specified on lower device
[mirror_ifupdown2.git] / ifupdown2 / ifupdownaddons / LinkUtils.py
index 8078093e6dcc20ead410539de92dff3eb7e63b2d..2b29bfeb27e518e02dca37f90acb347facc7d5be 100644 (file)
@@ -1090,7 +1090,7 @@ class LinkUtils(utilsBase):
         if key not in ['master', 'nomaster']:
             self._cache_update([ifacename, key], value)
 
-    def link_set_hwaddress(self, ifacename, hwaddress, force=False):
+    def link_set_hwaddress(self, ifacename, hwaddress, force=False, keep_down=False):
         if not force:
             link_hwaddress = self.link_get_hwaddress(ifacename)
 
@@ -1103,7 +1103,9 @@ class LinkUtils(utilsBase):
             self.add_to_batch(cmd)
         else:
             utils.exec_command('%s %s' % (utils.ip_cmd, cmd))
-        self.link_up(ifacename)
+
+        if not keep_down:
+            self.link_up(ifacename)
         self._cache_update([ifacename, 'hwaddress'], hwaddress)
         return True