]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
Revert "ifupdown: add new 'down [yes|no]' link attribute to keep link down"
authorRoopa Prabhu <roopa@cumulusnetworks.com>
Thu, 5 Jan 2017 18:50:48 +0000 (10:50 -0800)
committerRoopa Prabhu <roopa@cumulusnetworks.com>
Thu, 5 Jan 2017 18:50:48 +0000 (10:50 -0800)
This reverts commit 02e00f54bbf9d0ca647c1ed2c39f7af28b6653b7.

reverting this commit to move it to link.py addon module.
down conflicts with usercmds.py 'down'

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
addons/address.py
addons/bond.py
addons/bridge.py
addons/vlan.py
addons/vxlan.py
ifupdown/iface.py
ifupdown/ifupdownmain.py

index ed507d0ea60ed4edcb9cd543ef4b99555e0ab189..68c30cfedb6e10d484af43403515f70b5fe63cb2 100644 (file)
@@ -102,10 +102,6 @@ class address(moduleBase):
         if self.max_mtu:
             self.logger.info('address: using max mtu %s' %self.max_mtu)
 
-    def get_dependent_ifacenames(self, ifaceobj, ifacenames_all=None):
-        if ifaceobj.get_attr_value_first('down') == 'yes':
-            ifaceobj.link_privflags |= ifaceLinkPrivFlags.KEEP_LINK_DOWN
-
     def syntax_check(self, ifaceobj, ifaceobj_getfunc=None):
         return (self.syntax_check_multiple_gateway(ifaceobj)
                 and self.syntax_check_addr_allowed_on(ifaceobj, True)
index 829fbd5fc97268fc641f9a90f723269f56f10bce..401ec042036b755c2747ff1d760470f4192e3ac1 100644 (file)
@@ -304,6 +304,8 @@ class bond(moduleBase):
                 self.bondcmd.create_bond(ifaceobj.name)
             self._apply_master_settings(ifaceobj)
             self._add_slaves(ifaceobj)
+            if ifaceobj.addr_method == 'manual':
+                netlink.link_set_updown(ifaceobj.name, "up")
         except Exception, e:
             self.log_error(str(e), ifaceobj)
 
index b9b598c71f43f63501dab1791d9532360aac5acf..564bf83d1bd71d0551ae75e45f643e60ac37f8ff 100644 (file)
@@ -1289,6 +1289,12 @@ class bridge(moduleBase):
                         self.logger.debug('%s: %s: link set up (%s)'
                                           %(ifaceobj.name, p, str(e)))
                         pass
+
+            if ifaceobj.addr_method == 'manual':
+                try:
+                    netlink.link_set_updown(ifaceobj.name, "up")
+                except Exception as e:
+                    self.log_error('%s: %s' % (ifaceobj.name, str(e)), ifaceobj)
         if err:
             raise Exception(errstr)
 
index 0bdab469bae89dc2ecce7f4d6d45dd5e4eea925e..ad6dfaff7c72933db34d2026ed4c874cab787d4c 100644 (file)
@@ -141,6 +141,11 @@ class vlan(moduleBase):
                 return
         netlink.link_add_vlan(vlanrawdevice, ifaceobj.name, vlanid)
         self._bridge_vid_add_del(ifaceobj, vlanrawdevice, vlanid)
+        if ifaceobj.addr_method == 'manual':
+            try:
+                netlink.link_set_updown(ifaceobj.name, "up")
+            except Exception as e:
+                self.log_error('%s: %s' % (ifaceobj.name, str(e)), ifaceobj)
 
     def _down(self, ifaceobj):
         vlanid = self._get_vlan_id(ifaceobj)
index 8bdcd9fc9709cd4aaf78f6f629927dbfe54e8cdd..df5184368d1680bf0bd4bccf29455518fb3a3e47 100644 (file)
@@ -123,6 +123,9 @@ class vxlan(moduleBase):
                     except:
                         pass
 
+            if ifaceobj.addr_method == 'manual':
+                netlink.link_set_updown(ifaceobj.name, "up")
+
     def _up(self, ifaceobj):
         self._vxlan_create(ifaceobj)
 
index d883dbc065f54c3b7a5fda92baa82fa87ee735f5..98a3c89a0a67b08e0c70e2e7d4a67984b5654ac4 100644 (file)
@@ -64,7 +64,6 @@ class ifaceLinkPrivFlags():
     BRIDGE_VXLAN =      0x10000
     ADDRESS_VIRTUAL_SLAVE = 0x100000
     LOOPBACK = 0x1000000
-    KEEP_LINK_DOWN = 0x10000000
 
     @classmethod
     def get_str(cls, flag):
index 809950cce6dce2c4167969084ff4c7fdd8fa9497..cb0389ba70669b20d9b43d521cf2e5b22a6a603c 100644 (file)
@@ -115,10 +115,8 @@ class ifupdownMain(ifupdownBase):
         if ((ifaceobj.link_kind & ifaceLinkKind.VRF) or
             (ifaceobj.link_privflags & ifaceLinkPrivFlags.VRF_SLAVE)):
             return
-        # if not a logical interface and addr method is manual,
-        # ignore link admin state changes
-        if (ifaceobj.addr_method == 'manual' and
-            not ifaceobj.link_kind):
+        if (ifaceobj.addr_method and
+            ifaceobj.addr_method == 'manual'):
             return
         if self._delay_admin_state:
             self._delay_admin_state_iface_queue.append(ifaceobj.name)
@@ -131,12 +129,6 @@ class ifupdownMain(ifupdownBase):
             return
         if not self.link_exists(ifaceobj.name):
            return
-        if ifaceobj.link_privflags & ifaceLinkPrivFlags.KEEP_LINK_DOWN:
-            # user has asked to explicitly keep the link down,
-            # so, force link down
-            self.logger.info('%s: keeping link down due to user config' %ifaceobj.name)
-            self.link_down(ifaceobj.name)
-            return
         self.link_up(ifaceobj.name)
 
     def run_down(self, ifaceobj):
@@ -147,10 +139,8 @@ class ifupdownMain(ifupdownBase):
         # there is no real interface behind it
         if ifaceobj.type == ifaceType.BRIDGE_VLAN:
             return
-        # if not a logical interface and addr method is manual,
-        # ignore link admin state changes
-        if (ifaceobj.addr_method == 'manual' and
-            not ifaceobj.link_lind):
+        if (ifaceobj.addr_method and
+            ifaceobj.addr_method == 'manual'):
             return
         if self._delay_admin_state:
             self._delay_admin_state_iface_queue.append(ifaceobj.name)
@@ -478,12 +468,6 @@ class ifupdownMain(ifupdownBase):
 
     def _set_iface_role_n_kind(self, ifaceobj, upperifaceobj):
 
-        # If addr_method is set and link is not a logical interface,
-        # set flag KEEP_LINK_DOWN. addr_method == 'manual' only applies to
-        # logical interfaces.
-        if (ifaceobj.addr_method == 'manual' and not ifaceobj.link_kind):
-            ifaceobj.link_privflags |= ifaceLinkPrivFlags.KEEP_LINK_DOWN
-
         if (upperifaceobj.link_kind & ifaceLinkKind.BOND):
             self._set_iface_role(ifaceobj, ifaceRole.SLAVE, upperifaceobj)
             ifaceobj.link_privflags |= ifaceLinkPrivFlags.BOND_SLAVE