Language and Page Formatting Options
15.2. Adding a PCI device with virt-manager
PCI devices can be added to guests using the graphical
virt-managertool. The following procedure adds a 2 port USB controller to a guest.
Identify the deviceIdentify the PCI device designated for passthrough to the guest. The
virsh nodedev-listcommand lists all devices attached to the system. The
--treeoption is useful for identifying devices attached to the PCI device (for example, disk controllers and USB controllers).
# virsh nodedev-list --treeFor a list of only PCI devices, run the following command:
# virsh nodedev-list | grep pciEach PCI device is identified by a string in the following format (where 8086 is a variable that in this case represents Intel equipment, and **** is a four digit hexadecimal code specific to each device):
lspci -n(which turns off name resolution) output can assist in deriving which device has which device identifier code.Record the PCI device number; the number is needed in other steps.
Detach the PCI deviceDetach the device from the system.
# virsh nodedev-dettach pci_8086_3a6c Device pci_8086_3a6c dettached
Power off the guestPower off the guest. Hotplugging PCI devices into guests is presently unsupported and may fail or crash.
Open the hardware settingsOpen the virtual machine and select the Hardware tab. Click the Add Hardware button to add a new device to the guest.
Add the new deviceSelect Physical Host Device from the Hardware type list. The Physical Host Device represents PCI devices. Click Forward to continue.
Select a PCI deviceSelect an unused PCI device. Note that selecting PCI devices presently in use on the host causes errors. In this example a PCI to USB interface device is used.
Confirm the new deviceClick the Finish button to confirm the device setup and add the device to the guest.
The setup is complete and the guest can now use the PCI device.