Buscar

Este contenido no está disponible en el idioma seleccionado.

14.2. Attaching and Updating a Device with virsh

download PDF
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.
  1. Locate the USB device you want to attach with the following command:
    # lsusb -v
    
    idVendor           0x17ef Lenovo
    idProduct          0x480f Integrated Webcam [R5U877]
    
    
  2. 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

  3. 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.
  4. 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
Red Hat logoGithubRedditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

© 2024 Red Hat, Inc.