Este contenido no está disponible en el idioma seleccionado.
14.2. Attaching and Updating a Device with virsh
For information on attaching storage devices refer to Section 13.3.1, “Adding File-based Storage to a Guest”
Procedure 14.1. Hot plugging USB devices for use by the guest virtual machine
The following procedure demonstrates how to attach USB devices to the guest virtual machine. This can be done while the guest virtual machine is running as a hotplug procedure or it can be done while the guest is shutoff. The device you want to emulate needs to be attached to the host physical machine.
- Locate the USB device you want to attach with the following command:
# lsusb -v idVendor 0x17ef Lenovo idProduct 0x480f Integrated Webcam [R5U877]
- Create an XML file and give it a logical name (
usb_device.xml
, for example). Make sure you copy the vendor and product IDs exactly as was displayed in your search.<hostdev mode='subsystem' type='usb' managed='yes'> <source> <vendor id='0x17ef'/> <product id='0x480f'/> </source> </hostdev> ...
Figure 14.1. USB Devices XML Snippet
- Attach the device with the following command:
# virsh attach-device rhel6
--file usb_device.xml
--config
In this example [rhel6] is the name of your guest virtual machine and [usb_device.xml] is the file you created in the previous step. If you want to have the change take effect in the next reboot, use the--config
option. If you want this change to be persistent, use the--persistent
option. If you want the change to take effect on the current domain, use the--current
option. See the Virsh man page for additional information. - If you want to detach the device (hot unplug), perform the following command:
# virsh detach-device rhel6
--file usb_device.xml
In this example [rhel6] is the name of your guest virtual machine and [usb_device.xml] is the file you attached in the previous step