Red Hat Training
A Red Hat training course is available for Red Hat Enterprise Linux
12.4. Detaching an Assigned PCI Device
When a host PCI device has been assigned to a guest machine, the host can no longer use the device. Read this section to learn how to detach the device from the guest with
virsh
or virt-manager so it is available for host use.
Procedure 12.6. Detaching a PCI device from a guest with virsh
Detach the device
Use the following command to detach the PCI device from the guest by removing it in the guest's XML file:# virsh detach-device name_of_guest file.xml
Re-attach the device to the host (optional)
If the device is inmanaged
mode, skip this step. The device will be returned to the host automatically.If the device is not usingmanaged
mode, use the following command to re-attach the PCI device to the host machine:# virsh nodedev-reattach device
For example, to re-attach thepci_0000_01_00_0
device to the host:virsh nodedev-reattach pci_0000_01_00_0
The device is now available for host use.
Procedure 12.7. Detaching a PCI Device from a guest with virt-manager
Open the virtual hardware details screen
In virt-manager, double-click on the virtual machine that contains the device. Select the Show virtual hardware details button to display a list of virtual hardware.Figure 12.4. The virtual hardware details button
Select and remove the device
Select the PCI device to be detached from the list of virtual devices in the left panel.Figure 12.5. Selecting the PCI device to be detached
Click the Remove button to confirm. The device is now available for host use.