[libvirt-users] SCSI tape drive device

Mike Hall MHall at astc.nt.gov.au
Sun Oct 31 22:58:56 UTC 2010


I thought this was in the Virtusalisation Guide, but can't find it there now.
Anyway, this is how I got a USB device (printer in this case) passed through to a VM. The same general procedure may work for you:


Assuming the USB device is plugged in, powered on and has been recognised by the system, the first step is to locate vendor and product ID information for the device using lsusb:

# lsusb

Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
Bus 001 Device 002: ID 1058:1021 Western Digital Technologies, Inc.
Bus 004 Device 001: ID 0000:0000
Bus 004 Device 002: ID 046d:c018 Logitech, Inc. Optical Wheel Mouse
Bus 003 Device 002: ID 04f9:0033 Brother Industries, Ltd
Bus 003 Device 001: ID 0000:0000

The printer information is in the line containing 'Brother Industries, Ltd'. What we need are the hexadecimal numbers 04f9:0033.

The next step is to open the XML configuration file for the VM we wish to add this device to, and add the following section (from <hostdev> to </hostdev> inclusive). Notice how the numbers discovered above are added using the hexadecimal 0x prefix:

<domain type='kvm'>
  <name>vm_name</name>
  ...
  <devices>
    ...
    <hostdev mode='subsystem' type='usb'>
      <source>
        <vendor id='0x04f9'/>
        <product id='0x0033'/>
      </source>
    </hostdev>
    ...
  </devices>
</domain>

For this to work, it is necessary that the device in question is not in use on the host. In this case, the printer driver is not installed on the host so all is OK. Otherwise, it may be necessary to remove drivers from the host to be safe. For USB block devices, it is enough to simply not mount a device on the host.

Note also that the USB device must be attached to the host when the VM is booted, and remain attached. There is no Plug'n'Play type operation possible with this solution, although it is reportedly possible to enable such functionality.

When the VM is started using the modified XML configuration file, running lsusb on that machine should reveal that the USB device has now been passed through from the host to the guest. In this case, printer drivers can now be installed normally on the guest.




-----Original Message-----
From: libvirt-users-bounces at redhat.com [mailto:libvirt-users-bounces at redhat.com] On Behalf Of Tom Stave
Sent: Friday, 29 October 2010 10:58 PM
To: libvirt-users at redhat.com
Subject: [libvirt-users] SCSI tape drive device


I have a SCSI tape backup unit attached to a kvm host managed by
libvirt.  Is there a way to expose the SCSI device in libvirt so I could
pass the device to a virtual machine and have the virtual machine
control the tape backup?

Defining the device as a SCSI disk does not appear to work.

In this situation, live migration is not an issue.  The VM would always
be tied to this host.

_______________________________________________
libvirt-users mailing list
libvirt-users at redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users
-------------------------------Safe Stamp-----------------------------------
Your Anti-virus Service scanned this email. It is safe from known viruses. For more information regarding this service, please contact your service provider.





More information about the libvirt-users mailing list