Exemple #1
0
def _filter_available(persistent_config):
    """Returns only nets and bonds that can be configured with the devices
    present in the system"""

    available_nics = nics.nics()
    available_bonds = _find_bonds_with_available_nics(available_nics,
                                                      persistent_config.bonds)

    available_nets = _find_nets_with_available_devices(
        available_bonds, available_nics, persistent_config.bonds,
        persistent_config.networks)
    return BaseConfig(available_nets, available_bonds)
Exemple #2
0
def setup(networks, bondings, ping_fn):
    logging.info('Running VDSM setup of desired config: %s %s', networks,
                 bondings)
    canonicalize.canonicalize_networks(networks)
    canonicalize.canonicalize_bondings(bondings)
    _southbound_to_nic_or_bond(networks, bondings)
    _canonicalize_bondings(bondings)
    desired = BaseConfig(networks, bondings)
    diff = desired.diffFrom(RunningConfig())
    logging.info('Configuration difference to be applied: %s %s',
                 diff.networks, diff.bonds)

    if diff:
        _run_ping_check_thread(ping_fn, _CONNECTIVITY_TIMEOUT)
        netapi.setupNetworks(
            diff.networks, diff.bonds, {
                'connectivityCheck': True,
                'connectivityTimeout': _CONNECTIVITY_TIMEOUT
            })

    logging.info('Setup is now complete.')
 def test_empty_config(self):
     config = BaseConfig({}, {}, {})
     self.assertFalse(config)
 def test_empty_config(self):
     config = BaseConfig({}, {}, {})
     assert not config