Beispiel #1
0
    def removeNic(self, nic):
        toBeRemoved = not 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, mtus.DEFAULT_MTU)
                self.configApplier.ifdown(nic)
        else:
            self._setNewMtu(nic, vlans.vlan_devs_for_iface(nic.name))
Beispiel #2
0
 def removeNic(self, nic, remove_even_if_used=False):
     to_be_removed = self._ifaceDownAndCleanup(nic, remove_even_if_used)
     if to_be_removed:
         self.configApplier.removeNic(nic.name)
         if nic.name in nics.nics():
             _exec_ifup(nic.name)
         else:
             logging.warning('host interface %s missing', nic.name)
     else:
         set_mtu = self._setNewMtu(nic, vlans.vlan_devs_for_iface(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)])
Beispiel #3
0
 def removeNic(self, nic):
     to_be_removed = self._ifaceDownAndCleanup(nic)
     if to_be_removed:
         self.configApplier.removeNic(nic.name)
         if nic.name in nics.nics():
             _exec_ifup(nic.name)
         else:
             logging.warning('host interface %s missing', nic.name)
     else:
         set_mtu = self._setNewMtu(nic, vlans.vlan_devs_for_iface(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)])
Beispiel #4
0
    def removeBond(self, bonding):
        toBeRemoved = not 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,  mtus.DEFAULT_MTU)
                self.configApplier.ifdown(bonding)
        else:
            self._setNewMtu(bonding, vlans.vlan_devs_for_iface(bonding.name))
Beispiel #5
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.ipv4 = IPv4()
             bonding.ipv6 = IPv6()
             bonding.master = None
             bonding.configure()
     else:
         set_mtu = self._setNewMtu(bonding, vlans.vlan_devs_for_iface(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)])
Beispiel #6
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.ipv4 = IPv4()
             bonding.ipv6 = IPv6()
             bonding.master = None
             bonding.configure()
     else:
         set_mtu = self._setNewMtu(bonding,
                                   vlans.vlan_devs_for_iface(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)])