[libvirt] [PATCH V3 2/2] Add support for file descriptor sets

Stefan Berger stefanb at linux.vnet.ibm.com
Thu Feb 7 15:22:37 UTC 2013


On 02/07/2013 10:14 AM, Daniel P. Berrange wrote:
> On Mon, Feb 04, 2013 at 07:12:38PM -0500, Stefan Berger wrote:
>> Add support for file descriptor sets by converting some of the
>> command line parameters to use /dev/fdset/%d if -add-fd is found
>> to be supported by QEMU. For those devices libvirt now open()s
>> the device to obtain the file descriptor and 'transfers' the
>> fd using virCommand.
>>
>> For the following fragments of domain XML
>>
>>
>>      <disk type='file' device='disk'>
>>        <driver name='qemu' type='raw'/>
>>        <source file='/var/lib/libvirt/images/fc14-x86_64.img'/>
>>        <target dev='hda' bus='ide'/>
>>        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
>>      </disk>
>>
>>     <serial type='dev'>
>>        <source path='/dev/ttyS0'/>
>>        <target port='0'/>
>>      </serial>
>>      <serial type='pipe'>
>>        <source path='/tmp/testpipe'/>
>>        <target port='1'/>
>>      </serial>
>>
>> libvirt now creates the following parts for the QEMU command line:
>>
>> old: -drive file=/var/lib/libvirt/images/fc14-x86_64.img,if=none,id=drive-ide0-0-0,format=raw
>> new: -add-fd set=1,fd=23,opaque=RDONLY:/var/lib/libvirt/images/fc14-x86_64.img
>>       -add-fd set=1,fd=24,opaque=RDWR:/var/lib/libvirt/images/fc14-x86_64.img
>>       -drive file=/dev/fdset/1,if=none,id=drive-ide0-0-0,format=raw
>>
>> old: -chardev tty,id=charserial0,path=/dev/ttyS0
>> new: -add-fd set=1,fd=30,opaque=/dev/ttyS0
>>       -chardev tty,id=charserial0,path=/dev/fdset/1
>>
>> old: -chardev pipe,id=charserial1,path=/tmp/testpipe
>> new: -add-fd set=2,fd=32,opaque=/tmp/testpipe
>>       -chardev pipe,id=charserial1,path=/dev/fdset/2
> Given this significant change to the ARGV generation, I'd expect to
> see more than just this change in the test suite:

Which devices can we assume to be using in the test suite? I guess 
/dev/null would be a safe bet to not touch anything critical on a 
system. I'd add a patch on top of this series providing coverage.

   Stefan




More information about the libvir-list mailing list