Depending on the guest virtual machine architecture, it is possible to assign many virtual devices to a single bus. Under normal circumstances libvirt can automatically infer which controller to use for the bus. However, it may be necessary to provide an explicit
<controller>element in the guest virtual machine XML:
... <devices> <controller type='ide' index='0'/> <controller type='virtio-serial' index='0' ports='16' vectors='4'/> <controller type='virtio-serial' index='1'> <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/> <controller type='scsi' index='0' model='virtio-scsi' num_queues='8'/> </controller> ... </devices> ...
Figure 20.25. Controller Elements
Each controller has a mandatory attribute
type, which must be one of
"ide", "fdc", "scsi", "sata", "usb", "ccid", or "virtio-serial", and a mandatory attribute
indexwhich is the decimal integer describing in which order the bus controller is encountered (for use in controller attributes of
"virtio-serial"controller has two additional optional attributes,
vectors, which control how many devices can be connected through the controller.
<controller type='scsi'>has an optional attribute
model, which is one of
"vmpvscsi". It should be noted that virtio-scsi controllers and drivers will work on both KVM and Windows guest virtual machines. The
<controller type='scsi'>also has an attribute
num_queueswhich enables multi-queue support for the number of queues specified.
"usb"controller has an optional attribute
model, which is one of
"nec-xhci". Additionally, if the USB bus needs to be explicitly disabled for the guest virtual machine,
model='none'may be used. The PowerPC64 "spapr-vio" addresses do not have an associated controller.
For controllers that are themselves devices on a PCI or USB bus, an optional sub-element
addresscan specify the exact relationship of the controller to its master bus, with semantics given above.
USB companion controllers have an optional sub-element
masterto specify the exact relationship of the companion to its master controller. A companion controller is on the same bus as its master, so the companion index value should be equal.
... <devices> <controller type='usb' index='0' model='ich9-ehci1'> <address type='pci' domain='0' bus='0' slot='4' function='7'/> </controller> <controller type='usb' index='0' model='ich9-uhci1'> <master startport='0'/> <address type='pci' domain='0' bus='0' slot='4' function='0' multifunction='on'/> </controller> ... </devices> ...
Figure 20.26. Devices - controllers - USB