[libvirt] [PATCH 0/5]qemu: add usb-bot scsi controller support
Guan Nan Ren
gren at redhat.com
Tue Sep 3 16:14:53 UTC 2013
----- Original Message -----
From: "Daniel P. Berrange" <berrange at redhat.com>
To: "Guannan Ren" <gren at redhat.com>
Cc: libvir-list at redhat.com
Sent: Tuesday, September 3, 2013 5:38:08 AM
Subject: Re: [libvirt] [PATCH 0/5]qemu: add usb-bot scsi controller support
On Mon, Sep 02, 2013 at 05:38:39PM +0800, Guannan Ren wrote:
>>
>> 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>
> How does this work from a hotplug POV. With usb-storage you could
> just hotplug the <disk> device. Now it seems we need two separate
> hotplug calls one of the <controller> and one for the <disk> and
>the reverse.
Yes, I will think about the hotplug.
>>
>> 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>
> I'm not really a fan of introducing 2 different ways to configure
> the exact same device.
The idea is to use usb-bot instead of usb-storage in this case if usb-bot capability is available.
usb-storage automatically expands into two devices, a SCSI controller and a SCSI device. And user
cannot set any property values to this SCSI device such as vendor, product, wwn, channel, scsi-id
and lun. usb-bot gives the more flexible configurations.
I think it is to use usb-bot if usb-bot is supported, otherwise still use usb-storage. The xml
will not change at all.
Guannan
More information about the libvir-list
mailing list