コード例 #1
0
ファイル: restore_net_config.py プロジェクト: vjuranek/vdsm
def _restore_sriov_config():
    persistent_config = PersistentConfig()

    current_sriov_pci_devs = sriov.list_sriov_pci_devices()
    desired_sriov_pci_devs = {
        sriov.devname2pciaddr(devname)
        for devname, devattrs in six.viewitems(persistent_config.devices)
        if 'sriov' in devattrs
    }

    non_persisted_devs = current_sriov_pci_devs - desired_sriov_pci_devs
    if non_persisted_devs:
        logging.info(
            'Non persisted SRIOV devices found: %s', non_persisted_devs
        )
    missing_current_devs = desired_sriov_pci_devs - current_sriov_pci_devs
    if missing_current_devs:
        logging.error(
            'Persisted SRIOV devices could not be found: %s',
            missing_current_devs,
        )

    for sriov_devpci in current_sriov_pci_devs & desired_sriov_pci_devs:
        devname = sriov.pciaddr2devname(sriov_devpci)
        numvfs = persistent_config.devices[devname]['sriov']['numvfs']
        try:
            change_numvfs(sriov_devpci, numvfs, devname)
        except Exception:
            logging.exception(
                'Restoring VF configuration for device %s failed. '
                'Persisted nets built on this device will fail to restore.',
                devname,
            )
コード例 #2
0
ファイル: restore_net_config.py プロジェクト: nirs/vdsm
def _restore_sriov_config():
    persistent_config = PersistentConfig()

    current_sriov_pci_devs = sriov.list_sriov_pci_devices()
    desired_sriov_pci_devs = {
        sriov.devname2pciaddr(devname)
        for devname, devattrs in six.viewitems(persistent_config.devices)
        if 'sriov' in devattrs
    }

    non_persisted_devs = current_sriov_pci_devs - desired_sriov_pci_devs
    if non_persisted_devs:
        logging.info('Non persisted SRIOV devices found: %s',
                     non_persisted_devs)
    missing_current_devs = desired_sriov_pci_devs - current_sriov_pci_devs
    if missing_current_devs:
        logging.error('Persisted SRIOV devices could not be found: %s',
                      missing_current_devs)

    for sriov_devpci in (current_sriov_pci_devs & desired_sriov_pci_devs):
        devname = sriov.pciaddr2devname(sriov_devpci)
        numvfs = persistent_config.devices[devname]['sriov']['numvfs']
        try:
            change_numvfs(sriov_devpci, numvfs, devname)
        except Exception:
            logging.exception(
                'Restoring VF configuration for device %s failed. '
                'Persisted nets built on this device will fail to restore.',
                devname
            )
コード例 #3
0
ファイル: restore_net_config.py プロジェクト: EdDev/vdsm
def _restore_sriov_numvfs():
    sriov_devices = _get_sriov_devices()
    persisted_numvfs = _get_persisted_numvfs(sriov_devices)

    for device_libvirt_name in sriov_devices:
        pci_path = hostdev.name_to_pci_path(device_libvirt_name)
        desired_numvfs = persisted_numvfs.get(pci_path)
        if desired_numvfs is None:
            logging.info('SRIOV network device which is not persisted found '
                         'at: %s.', pci_path)
        else:
            logging.info('Changing number of virtual functions for device %s '
                         '-> %s', pci_path, desired_numvfs)
            try:
                net_name = hostdev.physical_function_net_name(
                    device_libvirt_name)
                change_numvfs(pci_path, desired_numvfs, net_name)
            except:
                logging.exception('restoring vf configuration for device %s '
                                  'failed. Persisted networks built on this '
                                  'device will fail to restore.', pci_path)
コード例 #4
0
def _restore_sriov_numvfs():
    sriov_devices = _get_sriov_devices()
    persisted_numvfs = _get_persisted_numvfs(sriov_devices)

    for device_libvirt_name in sriov_devices:
        pci_path = hostdev.name_to_pci_path(device_libvirt_name)
        desired_numvfs = persisted_numvfs.get(pci_path)
        if desired_numvfs is None:
            logging.info(
                'SRIOV network device which is not persisted found '
                'at: %s.', pci_path)
        else:
            logging.info(
                'Changing number of virtual functions for device %s '
                '-> %s', pci_path, desired_numvfs)
            try:
                net_name = hostdev.physical_function_net_name(
                    device_libvirt_name)
                change_numvfs(pci_path, desired_numvfs, net_name)
            except:
                logging.exception(
                    'restoring vf configuration for device %s '
                    'failed. Persisted networks built on this '
                    'device will fail to restore.', pci_path)