示例#1
0
    def configure(self, **opts):
        # When the bond is up and we are not changing the configuration that
        # is already applied in any way, we can skip the configuring.
        if (self.vlan and self.name in bonding.bondings()
                and (not self.configurator.unifiedPersistence
                     or self.name in self.configurator.runningConfig.bonds)
                and nics.operstate(self.name) == nics.OPERSTATE_UP
                and ifaceUsed(self.name) and self.mtu <= mtus.getMtu(self.name)
                and self.areOptionsApplied()
                and frozenset(slave.name
                              for slave in self.slaves) == frozenset(
                                  bonding.slaves(self.name))):
            return

        self.configurator.configureBond(self, **opts)
示例#2
0
 def configureBond(self, bond, **opts):
     self.configApplier.addBond(bond)
     if not bond.areOptionsApplied():
         self.configApplier.ifdown(bond)
         self.configApplier.addBondOptions(bond)
     for slave in bond.slaves:
         if slave.name not in bonding.slaves(bond.name):
             self.configApplier.addBondSlave(bond, slave)
             slave.configure(**opts)
     DynamicSourceRoute.addInterfaceTracking(bond)
     self.configApplier.setIfaceConfigAndUp(bond)
     self._addSourceRoute(bond)
     self.runningConfig.setBonding(
         bond.name, {'options': bond.options,
                     'nics': [slave.name for slave in bond.slaves],
                     'switch': 'legacy'})
示例#3
0
    def configure(self, **opts):
        # When the bond is up and we are not changing the configuration that
        # is already applied in any way, we can skip the configuring.
        if (self.vlan and
            self.name in bonding.bondings() and
            (not self.configurator.unifiedPersistence or
             self.name in self.configurator.runningConfig.bonds) and
            nics.operstate(self.name) == nics.OPERSTATE_UP and
            ifaceUsed(self.name) and
            self.mtu <= mtus.getMtu(self.name) and
            self.areOptionsApplied() and
            frozenset(slave.name for slave in self.slaves) ==
                frozenset(bonding.slaves(self.name))):
                return

        self.configurator.configureBond(self, **opts)
示例#4
0
 def setBondingMtu(self, bonding, newmtu):
     self.setIfaceMtu(bonding, newmtu)
     slaves = netinfo_bonding.slaves(bonding)
     for slave in slaves:
         self.setIfaceMtu(slave, newmtu)
示例#5
0
文件: ifcfg.py 项目: nirs/vdsm
 def setBondingMtu(self, bonding, newmtu):
     self.setIfaceMtu(bonding, newmtu)
     slaves = netinfo_bonding.slaves(bonding)
     for slave in slaves:
         self.setIfaceMtu(slave, newmtu)
示例#6
0
def _net_nics(attrs):
    if 'bonding' in attrs:
        return bonding.slaves(attrs['bonding'])
    else:
        return [attrs.pop('nic')] if 'nic' in attrs else ()
示例#7
0
def _net_nics(attrs):
    if 'bonding' in attrs:
        return bonding.slaves(attrs['bonding'])
    else:
        return [attrs.pop('nic')] if 'nic' in attrs else ()