xcp.dmv

Driver Multiversion (DMV) Management for XenServer

This module provides functionality to manage multiple hardware driver variants across different kernel versions. It enables detection, selection, and activation of appropriate driver modules based on hardware presence and system configuration.

Features: - Scans /lib/modules/<version>/dmv and /lib/modules/<version>/updates for dmv drivers. - Detects active and loaded driver modules - Matches hardware PCI IDs to supported driver variants - Manages symlinks and updates for selected drivers - Provides structured information about available drivers and their status

Main Classes: - DriverMultiVersion: Handles driver variant selection and info parsing - DriverMultiVersionManager: Aggregates and manages DMV data across the system

Typical Usage:

manager = DriverMultiVersionManager(runtime=True) manager.parse_dmv_list() dmv_info = manager.get_dmv_list()

class xcp.dmv.DriverMultiVersion(updates_dir, lspci_out, runtime=False)[source]

Bases: object

parse_dmv_info(fpath)[source]

Populate dmv list with information

variant_selected(modules)[source]

Check and return which driver is selected

class xcp.dmv.DriverMultiVersionManager(runtime=False)[source]

Bases: object

get_dmv_error()[source]
get_dmv_list()[source]
merge_jsondata(oldone, newone)[source]
parse_dmv_file(fpath)[source]
parse_dmv_list()[source]
process_dmv_data(json_data, json_formatted)[source]
set_dmv_error(errcode)[source]
xcp.dmv.get_active_variant(modules)[source]

Check and report active driver

xcp.dmv.get_all_kabi_dirs()[source]

Return a list of (kabi_ver, updates_dir, dmv_dir) tuples for all kernel versions.

xcp.dmv.get_loaded_modules(modules)[source]

Return all loaded modules

xcp.dmv.hardware_present(lspci_out, pci_ids)[source]

Checks if any of the specified PCI IDs are present in the output of lspci -nm.

Args:

lspci_out (str): The output string from the lspci -nm command. pci_ids (list or set): A collection of PCI IDs to search for in the output.

Returns:

bool: True if any of the given PCI IDs are found in the lspci_out, False otherwise.

xcp.dmv.id_matches(id1, id2)[source]
xcp.dmv.note_offset(var_len)[source]

Note section has 4 bytes padding

xcp.dmv.pci_matches(present_pci_id, driver_pci_ids)[source]

Check if present PCI ID matches any of the driver PCI IDs.