BZ:https://bugzilla.redhat.com/show_bug.cgi?id=917702 qemu patch:http://lists.gnu.org/archive/html/qemu-devel/2013-01/msg02200.html These patch aims to add usb-bot SCSI controller support for libvirt. As usb-storage libvirt already supported, usb-bot only supports one SCSI target with SCSI ID 0. The difference is that usb-storage creates SCSI HBA and additionaly either a scsi-disk or a scsi-generic device, usb-bot only creates the SCSI HBA. we can attach a SCSI device to it with another -device. usb-bot supports a single target and a number of luns. The limit is 15 luns (0~15 LUN ID) and they must be contiguous(using lun 0 and 2 without 1 doesn't work). Athought usb-bot is a SCSI controller it needs to be attached to a exsiting USB controller for work. So it has to use address of usb type. Libvirt XML: <devices> ... <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/disk.qcow2'/> <target dev='sdc' bus='scsi'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> <controller type='usb' index='0'/> <controller type='scsi' index='0' model='usb-bot'> <address type='usb' bus='0' port='1'/> </controller> ... </devices> The QEMU commandline: qemu ${other_vm_args} \ -device piix3-usb-uhci,id=usb \ -device usb-bot,id=scsi0,bus=usb.0,port=1 \ -drive file=/var/lib/libvirt/images/disk.qcow2,if=none,id=drive-scsi0-0-0-0,format=raw \ -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 As the usb-storage creates scsi disk automatically which doesn't let you set scsi-disk properties such as vendor, product, wwn, channel, scsi-id and lun. So QEMU guys prefer usb-bot to usb-storage. So this is the first part of the whole work. Next step will replace usb-storage with usb-bot when disk in xml uses usb bus like <disk ...> <...> <target bus='usb'> </disk> Guannan Ren(5) qemu: add usb-bot qemu cap flag qemu: add usb-bot model scsi controller support qemu: add usb-bot support from disks points of view qemu: refactor out function to build scsi device qemu commandline tests: add xml2argv test for usb-bot scsi controller docs/formatdomain.html.in | 4 +-- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- src/conf/domain_conf.h | 5 +++ src/libvirt_private.syms | 1 + src/qemu/qemu_capabilities.c | 3 ++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 124 ++++++++++++++++++++++++++++++++++++++++++------------------------------- src/vmx/vmx.c | 3 +- tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-usbbot.args | 10 ++++++ tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-usbbot.xml | 33 ++++++++++++++++++++ tests/qemuxml2argvtest.c | 3 ++ 12 files changed, 242 insertions(+), 57 deletions(-) -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list