Exemplo n.º 1
0
    def removeNic(self, nic):
        toBeRemoved = not netinfo.ifaceUsed(nic.name)

        if toBeRemoved:
            if nic.master is None:
                self.configApplier.removeIpConfig(nic)
            else:
                self.configApplier.setIfaceMtu(nic.name,
                                               netinfo.DEFAULT_MTU)
                self.configApplier.ifdown(nic)
        else:
            self._setNewMtu(nic, netinfo.vlanDevsForIface(nic.name))
Exemplo n.º 2
0
    def removeNic(self, nic):
        toBeRemoved = not netinfo.ifaceUsed(nic.name)

        if toBeRemoved:
            if nic.master is None:
                self.configApplier.removeIpConfig(nic)
                DynamicSourceRoute.addInterfaceTracking(nic)
                self._removeSourceRoute(nic, DynamicSourceRoute)
            else:
                self.configApplier.setIfaceMtu(nic.name, netinfo.DEFAULT_MTU)
                self.configApplier.ifdown(nic)
        else:
            self._setNewMtu(nic, netinfo.vlanDevsForIface(nic.name))
Exemplo n.º 3
0
    def removeNic(self, nic):
        toBeRemoved = not netinfo.ifaceUsed(nic.name)

        if toBeRemoved:
            if nic.master is None:
                self.configApplier.removeIpConfig(nic)
                DynamicSourceRoute.addInterfaceTracking(nic)
                self._removeSourceRoute(nic, DynamicSourceRoute)
            else:
                self.configApplier.setIfaceMtu(nic.name, netinfo.DEFAULT_MTU)
                self.configApplier.ifdown(nic)
        else:
            self._setNewMtu(nic, netinfo.vlanDevsForIface(nic.name))
Exemplo n.º 4
0
 def removeNic(self, nic):
     to_be_removed = self._ifaceDownAndCleanup(nic)
     if to_be_removed:
         self.configApplier.removeNic(nic.name)
         if nic.name in netinfo.nics():
             _exec_ifup(nic.name)
         else:
             logging.warning('host interface %s missing', nic.name)
     else:
         set_mtu = self._setNewMtu(nic, netinfo.vlanDevsForIface(nic.name))
         # Since we are not taking the device up again, ifcfg will not be
         # read at this point and we need to set the live mtu value
         if set_mtu is not None:
             ipwrapper.linkSet(nic.name, ['mtu', str(set_mtu)])
Exemplo n.º 5
0
 def removeNic(self, nic):
     to_be_removed = self._ifaceDownAndCleanup(nic)
     if to_be_removed:
         self.configApplier.removeNic(nic.name)
         if nic.name in netinfo.nics():
             ifup(nic.name)
         else:
             logging.warning('host interface %s missing', nic.name)
     else:
         set_mtu = self._setNewMtu(nic, netinfo.vlanDevsForIface(nic.name))
         # Since we are not taking the device up again, ifcfg will not be
         # read at this point and we need to set the live mtu value
         if set_mtu is not None:
             ipwrapper.linkSet(nic.name, ['mtu', str(set_mtu)])
Exemplo n.º 6
0
    def removeBond(self, bonding):
        toBeRemoved = not netinfo.ifaceUsed(bonding.name)

        if toBeRemoved:
            if bonding.master is None:
                self.configApplier.removeIpConfig(bonding)

            if bonding.destroyOnMasterRemoval:
                self._destroyBond(bonding)
                self.runningConfig.removeBonding(bonding.name)
            else:
                self.configApplier.setIfaceMtu(bonding.name,
                                               netinfo.DEFAULT_MTU)
                self.configApplier.ifdown(bonding)
        else:
            self._setNewMtu(bonding, netinfo.vlanDevsForIface(bonding.name))
Exemplo n.º 7
0
    def removeBond(self, bonding):
        toBeRemoved = not netinfo.ifaceUsed(bonding.name)

        if toBeRemoved:
            if bonding.master is None:
                self.configApplier.removeIpConfig(bonding)
                DynamicSourceRoute.addInterfaceTracking(bonding)
                self._removeSourceRoute(bonding, DynamicSourceRoute)

            if bonding.destroyOnMasterRemoval:
                self._destroyBond(bonding)
                self.runningConfig.removeBonding(bonding.name)
            else:
                self.configApplier.setIfaceMtu(bonding.name,
                                               netinfo.DEFAULT_MTU)
                self.configApplier.ifdown(bonding)
        else:
            self._setNewMtu(bonding, netinfo.vlanDevsForIface(bonding.name))
Exemplo n.º 8
0
 def removeBond(self, bonding):
     to_be_removed = self._ifaceDownAndCleanup(bonding)
     if to_be_removed:
         self.configApplier.removeBonding(bonding.name)
         if bonding.destroyOnMasterRemoval:
             for slave in bonding.slaves:
                 slave.remove()
             if self.unifiedPersistence:
                 self.runningConfig.removeBonding(bonding.name)
         else:  # Recreate the bond with ip and master info cleared
             bonding.ip = bonding.master = None
             bonding.configure()
     else:
         set_mtu = self._setNewMtu(bonding,
                                   netinfo.vlanDevsForIface(bonding.name))
         # Since we are not taking the device up again, ifcfg will not be
         # read at this point and we need to set the live mtu value.
         # Note that ip link set dev bondX mtu Y sets Y on all its links
         if set_mtu is not None:
             ipwrapper.linkSet(bonding.name, ['mtu', str(set_mtu)])
Exemplo n.º 9
0
 def removeBond(self, bonding):
     to_be_removed = self._ifaceDownAndCleanup(bonding)
     if to_be_removed:
         self.configApplier.removeBonding(bonding.name)
         if bonding.destroyOnMasterRemoval:
             for slave in bonding.slaves:
                 slave.remove()
             if self.unifiedPersistence:
                 self.runningConfig.removeBonding(bonding.name)
         else:  # Recreate the bond with ip and master info cleared
             bonding.ip = bonding.master = None
             bonding.configure()
     else:
         set_mtu = self._setNewMtu(bonding,
                                   netinfo.vlanDevsForIface(bonding.name))
         # Since we are not taking the device up again, ifcfg will not be
         # read at this point and we need to set the live mtu value.
         # Note that ip link set dev bondX mtu Y sets Y on all its links
         if set_mtu is not None:
             ipwrapper.linkSet(bonding.name, ['mtu', str(set_mtu)])
Exemplo n.º 10
0
 def removeBond(self, bonding):
     to_be_removed = self._ifaceDownAndCleanup(bonding)
     if to_be_removed:
         if bonding.destroyOnMasterRemoval:
             self.configApplier.removeBonding(bonding.name)
             for slave in bonding.slaves:
                 slave.remove()
             if self.unifiedPersistence:
                 self.runningConfig.removeBonding(bonding.name)
         else:
             self.configApplier.setBondingMtu(bonding.name,
                                              netinfo.DEFAULT_MTU)
             if bonding.bridge is not None:
                 self.configApplier._updateConfigValue(
                     netinfo.NET_CONF_PREF + bonding.name, 'BRIDGE', None)
             ifup(bonding.name)
     else:
         set_mtu = self._setNewMtu(bonding,
                                   netinfo.vlanDevsForIface(bonding.name))
         # Since we are not taking the device up again, ifcfg will not be
         # read at this point and we need to set the live mtu value.
         # Note that ip link set dev bondX mtu Y sets Y on all its links
         if set_mtu is not None:
             ipwrapper.linkSet(bonding.name, ['mtu', str(set_mtu)])