[libvirt] [PATCH 0/6] add qemu usb-scsi controller support

Guannan Ren gren at redhat.com
Mon Jan 14 09:04:19 UTC 2013


This patchset tries to add usb-scsi model for SCSI controller.
http://lists.gnu.org/archive/html/qemu-devel/2012-06/msg03382.html

"usb-uas is a pure UAS (usb attached scsi) emulation.
The emulation works like any other scsi hba emulation (eps, lsi, virtio,
megasas, ...).  It provides just the HBA where you can attach scsi
devices as you like using '-device'.  A single scsi target with up to
256 luns is supported. For now only usb 2.0 transport is supported."

libvirt XML snip
 <devices>
   <controller type='usb' index='2' model='ehci'>
   </controller>
   <controller type='scsi' index='0' model='usb-scsi'>
     <address type='usb' bus='2' port='1'/>
   </controller>
 </devices>

qemu commandline:
qemu ${other_vm_args}              \
     -device usb-ehci,id=usb2,bus=pci.0,addr=0x8 \
     -device usb-uas,id=scsi0,bus=usb2.0,port=1

When a scsi disk is attached to usb-scsi controller, the target
id must 0(usb-scsi only provide one scsi target). The unit value
must in range of 0~255 for its lun number.

As for the guest, the kernel with CONFIG_USB_UAS=y is necessary to have it show up
scsi disk attached to UAS. Fedora has the kernel driver disabled by default though.
(thanks to Gerd Hoffmann's suggestion)
I grabbed linux-3.7.1 version from kernel website. It works after compiling.

Guannan Ren(6)
[PATCH 1/6] conf: declare usb spec and port number enum for usb
[PATCH 2/6] conf: store usb spec and nports info when parsing usb
[PATCH 3/6] qemu: add usb-uas caps flag
[PATCH 4/6] qemu: add usb scsi controller support
[PATCH 5/6] qemu: add usb-scsi controller checking when building
[PATCH 6/6] test: add qemuxml2argv disk-scsi-uas testcase

 docs/formatdomain.html.in                              |  25 +++++-
 docs/schemas/domaincommon.rng                          |   1 +
 src/conf/domain_conf.c                                 | 213 ++++++++++++++++++++++++++++++++++++++------
 src/conf/domain_conf.h                                 |  25 +++++-
 src/qemu/qemu_capabilities.c                           |   2 +
 src/qemu/qemu_capabilities.h                           |   1 +
 src/qemu/qemu_command.c                                |  41 +++++++--
 src/vmx/vmx.c                                          |   3 +-
 tests/qemuhelptest.c                                   |   6 +-
 tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-uas.args |  10 +++
 tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-uas.xml  |  34 +++++++
 tests/qemuxml2argvtest.c                               |   3 +
 12 files changed, 326 insertions(+), 38 deletions(-)




More information about the libvir-list mailing list