On 01/22/2013 12:07 PM, Stefan Berger wrote:
On 01/22/2013 01:29 PM, Daniel P. Berrange wrote:
> On Tue, Jan 22, 2013 at 01:09:50PM -0500, Stefan Berger wrote:
>> Add two API calls to virCommand for generating the parameters necessary
>> for passing to the QEMU -add-fd option, for example "set=10,fd=20",
>> and the file descriptor set for the path= option, such as for example
>> "/dev/fdset/10"
>>
>> Regards,
>> Stefan
>>
>> ---
>> src/libvirt_private.syms | 2 +
>> src/util/vircommand.c | 65
>> +++++++++++++++++++++++++++++++++++++++++++----
>> src/util/vircommand.h | 6 ++++
>> 3 files changed, 68 insertions(+), 5 deletions(-)
> This is the wrong place to be adding QEMU specific APIs - it should
> be in qemu_command.{c,h}
Assuming I move the code into qemu_command.c, are the function calls ok?
Thanks for starting on this; it is something I have also been planning
to work on.
First, we need more than just moving it into qemu_command.c; we also
need a qemu_capabilities change to add a capability to know when the
feature is available. Or even two: 'add-fd' monitor command was added
in 1.2, but -add-fd command line option wasn't until 1.3. Then again,
maybe it's just simpler to state that if you are targeting qemu 1.2,
there is nothing worth using the new add-fd QMP command for that cannot
already be done with older fallbacks, and it is only 1.3 and later where
the new fd passing becomes essential.
Then, based on the capability being present or absent, any code in
qemu_command that wants to pass an fd to qemu needs to call into a
helper routine that will either use the new -add-fd argument, fall back
to older ad-hoc processing, or error out if there is no fallback for
that particular usage.
Then we also need to use the QMP commands to update the fdsets after
qemu is started; depending on what the fd is used for, we can close the
fd once qemu has dup'd it into internal use, so that qemu doesn't hang
on to the fd that libvirt passed in forever even when it's internal use
is hot-unplugged.
We also need to figure out how to use the QMP commands during hotplug
operations, instead of the command line additions at qemu startup.
And there's still the nagging issue that even as of qemu 1.4, there is
still no way to specify block device backing chains via fds; so even if
we can pass in an fd for some use cases (like TPM), we are still waiting
for qemu to give us a way to do it in all use cases (like NFS security
for qcow2 backing chains across snapshots, block copy, and block
commit). But one thing at a time.
How much of this work are you planning on attempting, and how much do
you need me to do?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org