[libvirt] [PATCHv2 0/4]add support usb redirection filter

Guannan Ren gren at redhat.com
Thu Sep 13 09:24:16 UTC 2012


On 09/13/2012 05:14 PM, Daniel P. Berrange wrote:
> On Thu, Sep 13, 2012 at 03:25:44PM +0800, Guannan Ren wrote:
>> v2 fixed:
>> (1) type int->size_t
>> (2) Don't output filter attributes with default -1 value in XML.
>> (3) Treat 0x0(0 decimal) as valid value for USB vendorID and productID
>>      as well as USB classID and bcdDevice code.
>> (4) doc fixed.
>>
>> BZ RFE https://bugzilla.redhat.com/show_bug.cgi?id=795929
>> qemu support:
>> http://git.qemu.org/?p=qemu.git;a=commitdiff;h=6af165892cf900291046f1d25f95416f379504c2
>>
>> Since qemu has have the code to support USB redirection filter. This set of
>> patches try to support it from libvirt.
>> The input XML format is like this:
>>   <devices>
>>     ...
>>     <redirdev bus='usb' type='spicevmc'>
>>       <address type='usb' bus='0' port='4'/>
>>     </redirdev>
>>     <redirfilter>
>>       <usbdev class='0x08' vendor='0x1234' product='0xbeef' \
>>               version='2.00' allow='yes'/>
>>       <usbdev allow='no'/>
>>     </redirfilter>
>>     ...
>>   </devices>
>>
>> Multiple <usbdev> element as one of filter rule could be added into parent
>> element <redirfilter>, only no more than <redirfilter> element could exists.
>> There is no 1:1 mapping between ports and redirected devices and qemu and
>> spicy client couldn't decide into which usbredir ports the client can 'plug'
>> redirected devices. So it make sense to apply all of filter rules global to
>> all existing usb redirection devices. class attribute is USB Class codes.
>> version is bcdDevice value of USB device. vendor and product is USB vendorId
>> and productId.
>> -1 can be used to allow any value for a field. Except allow attribute
>> the other four are optional, default value is -1.
>>
>> The above XML will be converted to the following qemu command line:
>> If there are multiple usb-redir device, all of them have the same filter rules.
>> -device usb-redir,chardev=charredir0,id=redir0,\
>> filter=0x08:0x1234:0xBEEF:0x2000:1|-1:-1:-1:-1:0,bus=usb.0,port=4
>>
>> Guannan Ren(0/4)
>>    qemu: define and parse USB redirection filter XML
>>    qemu: build USB redirection filter qemu command line
>>    test: add xml2argvtest for usb-redir filter and update
>>    doc: update usb redirection filter infomation on
>>
>>   docs/formatdomain.html.in                                 |  38 +++++++++++------
>>   docs/schemas/domaincommon.rng                             |  66 +++++++++++++++++++++++++++++
>>   src/conf/domain_conf.c                                    | 339 +++++++++++++++++++++++++++++..
>>   src/conf/domain_conf.h                                    |  21 +++++++++
>>   src/qemu/qemu_command.c                                   |  45 +++++++++++++++++++-
>>   src/qemu/qemu_command.h                                   |   5 ++-
>>   src/qemu/qemu_hotplug.c                                   |   3 +-
>>   tests/qemuxml2argvdata/qemuxml2argv-usb-redir-filter.args |  10 +++++
>>   tests/qemuxml2argvdata/qemuxml2argv-usb-redir-filter.xml  |  45 ++++++++++++++++++++
>>   tests/qemuxml2argvtest.c                                  |   6 +++
>>   10 files changed, 559 insertions(+), 19 deletions(-)
> ACK to all 4 now
>
> Daniel

     Thanks and pushed. :)

     Guannan




More information about the libvir-list mailing list