On 12/17/2013 02:47 AM, Jianwei Hu wrote:
Hi guys,
I want to attach a few USB disks to specified USB controller in domain on libvirt layer,
but I didn't find any method to deal with it. Anyone can help me on that?
I added some USB type disk to my domain, started it, I found all USB disk had been
attached to same USB controller automatically, I want to assign some USB disks to another
controller manually but I can't find the entry. qemu-kvm has provided command line to
support it by using "bus" argument.(like: device_add
usb-storage,id=my_usb_disk,drive=my_usb_disk,bus=usb.0 )
Action steps:
1. Add some USB disks to domain xml,
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/usb-img/usb-1.img'/>
<target dev='sda' bus='usb'/>
<alias name='usb-disk0'/>
</disk>
To force the guest to see the device under a particular UBS controller,
you need to include an <address> designation in your XML.
Check the 'virsh dumpxml' output to see what <address> got autogenerated
for your use case, then adjust the bus number in that address to instead
point to the controller number you want it associated with.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org