|
20 | 20 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
21 | 21 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
22 | 22 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 | +""" |
| 24 | +Driver Multiversion (DMV) Management for XenServer/XCP-ng |
| 25 | +
|
| 26 | +This module provides functionality to manage multiple hardware driver variants |
| 27 | +across different kernel versions. It enables detection, selection, and activation |
| 28 | +of appropriate driver modules based on hardware presence and system configuration. |
| 29 | +
|
| 30 | +Features: |
| 31 | +- Scans available kernel ABI (kabi) directories for driver variants |
| 32 | +- Detects active and loaded driver modules |
| 33 | +- Matches hardware PCI IDs to supported driver variants |
| 34 | +- Manages symlinks and updates for selected drivers |
| 35 | +- Provides structured information about available drivers and their status |
| 36 | +
|
| 37 | +Main Classes: |
| 38 | +- DriverMultiVersion: Handles driver variant selection and info parsing |
| 39 | +- DriverMultiVersionManager: Aggregates and manages DMV data across the system |
| 40 | +
|
| 41 | +Typical Usage: |
| 42 | + manager = DriverMultiVersionManager(runtime=True) |
| 43 | + manager.parse_dmv_list() |
| 44 | + dmv_info = manager.get_dmv_list() |
| 45 | +""" |
23 | 46 |
|
24 | 47 | import os |
25 | 48 | import subprocess |
@@ -138,7 +161,16 @@ def pci_matches(present_pci_id, driver_pci_ids): |
138 | 161 | return False |
139 | 162 |
|
140 | 163 | def hardware_present(lspci_out, pci_ids): |
141 | | - """Check if supported hardware is fitted""" |
| 164 | + """ |
| 165 | + Checks if any of the specified PCI IDs are present in the output of `lspci -nm`. |
| 166 | +
|
| 167 | + Args: |
| 168 | + lspci_out (str): The output string from the `lspci -nm` command. |
| 169 | + pci_ids (list or set): A collection of PCI IDs to search for in the output. |
| 170 | +
|
| 171 | + Returns: |
| 172 | + bool: True if any of the given PCI IDs are found in the `lspci_out`, False otherwise. |
| 173 | + """ |
142 | 174 | if not pci_ids or not lspci_out: |
143 | 175 | return False |
144 | 176 |
|
|
0 commit comments