Host device management

Libvirt provides management of both physical and virtual host devices (historically also referred to as node devices) like USB, PCI, SCSI, and network devices. This also includes various virtualization capabilities which the aforementioned devices provide for utilization, for example SR-IOV, NPIV, MDEV, DRM, etc.

The node device driver provides means to list and show details about host devices (virsh nodedev-list, virsh nodedev-dumpxml), which are generic and can be used with all devices. It also provides means to create and destroy devices (virsh nodedev-create, virsh nodedev-destroy) which are meant to be used to create virtual devices, currently only supported by NPIV (more info about NPIV)). Devices on the host system are arranged in a tree-like hierarchy, with the root node being called computer. The node device driver supports udev backend (HAL backend was removed in 6.8.0).

Details of the XML format of a host device can be found here. Of particular interest is the capability element, which describes features supported by the device. Some specific device types are addressed in more detail below.

Basic structure of a node device

<device>
  <name>pci_0000_00_17_0</name>
  <path>/sys/devices/pci0000:00/0000:00:17.0</path>
  <parent>computer</parent>
  <driver>
    <name>ahci</name>
  </driver>
  <capability type='pci'>
...
  </capability>
</device>