Exemple #1
0
    def configureBond(self, bond, **opts):
        if not self.owned_device(bond.name):
            IfcfgAcquire.acquire_device(bond.name)
        self.configApplier.addBonding(bond, self.net_info, **opts)
        if not link_vlan.is_base_device(bond.name):
            for slave in bond.slaves:
                ifdown(slave.name)
        for slave in bond.slaves:
            slave.configure(**opts)
        self._addSourceRoute(bond)
        _ifup(bond)

        # When acquiring the device from NM, it may take a few seconds until
        # the bond is released by NM and loaded through initscripts.
        # Giving it a chance to come up before continuing.
        with waitfor.waitfor_linkup(bond.name):
            pass

        bond_attr = {
            'options': bond.options,
            'nics': sorted(s.name for s in bond.slaves),
            'switch': 'legacy',
        }
        if bond.hwaddr:
            bond_attr['hwaddr'] = bond.hwaddr
        self.runningConfig.setBonding(bond.name, bond_attr)
Exemple #2
0
 def configureNic(self, nic, **opts):
     if not self.owned_device(nic.name):
         IfcfgAcquire.acquire_device(nic.name)
     self.configApplier.addNic(nic, self.net_info, **opts)
     self._addSourceRoute(nic)
     if nic.bond is None:
         if not link_vlan.is_base_device(nic.name):
             ifdown(nic.name)
         _ifup(nic)
Exemple #3
0
 def configureNic(self, nic, **opts):
     if not self.owned_device(nic.name):
         IfcfgAcquire.acquire_device(nic.name)
     self.configApplier.addNic(nic, self.net_info, **opts)
     self._addSourceRoute(nic)
     if nic.bond is None:
         if not link_vlan.is_base_device(nic.name):
             ifdown(nic.name)
         _ifup(nic)
Exemple #4
0
 def configureNic(self, nic, **opts):
     if not self.owned_device(nic.name):
         IfcfgAcquire.acquire_device(nic.name)
     self.configApplier.addNic(nic, self.net_info, **opts)
     self._addSourceRoute(nic)
     if nic.bond is None:
         if not link_vlan.is_base_device(nic.name):
             if nic.bridge is not None:
                 dhclient.stop(nic.name, 4)
                 dhclient.stop(nic.name, 6)
                 ipwrapper.linkSet(nic.name, ['down'])
             else:
                 ifdown(nic.name)
         _ifup(nic)
Exemple #5
0
    def configureBond(self, bond, **opts):
        if not self.owned_device(bond.name):
            IfcfgAcquire.acquire_device(bond.name)
        self.configApplier.addBonding(bond, self.net_info, **opts)
        if not link_vlan.is_base_device(bond.name):
            for slave in bond.slaves:
                ifdown(slave.name)
        for slave in bond.slaves:
            slave.configure(**opts)
        self._addSourceRoute(bond)
        _ifup(bond)

        # When acquiring the device from NM, it may take a few seconds until
        # the bond is released by NM and loaded through initscripts.
        # Giving it a chance to come up before continuing.
        with waitfor.waitfor_linkup(bond.name):
            pass

        bond_attr = {'options': bond.options,
                     'nics': sorted(s.name for s in bond.slaves),
                     'switch': 'legacy'}
        if bond.hwaddr:
            bond_attr['hwaddr'] = bond.hwaddr
        self.runningConfig.setBonding(bond.name, bond_attr)
Exemple #6
0
 def test_identify_non_vlan_base_device(self):
     with dummy_device() as nic:
         self.assertFalse(vlan.is_base_device(nic))
Exemple #7
0
 def test_identify_vlan_base_device(self):
     with dummy_device() as nic:
         with vlan_device(nic, tag=999):
             self.assertTrue(vlan.is_base_device(nic))
Exemple #8
0
 def test_identify_non_vlan_base_device(self):
     with dummy_device() as nic:
         self.assertFalse(vlan.is_base_device(nic))
Exemple #9
0
 def test_identify_vlan_base_device(self):
     with dummy_device() as nic:
         with vlan_device(nic, tag=999):
             self.assertTrue(vlan.is_base_device(nic))
Exemple #10
0
 def test_identify_non_vlan_base_device(self, nic0):
     assert not vlan.is_base_device(nic0)
Exemple #11
0
 def test_identify_vlan_base_device(self, nic0, vlan999):
     assert vlan.is_base_device(nic0)