[libvirt] [PATCH 2/2] qemu: use -incoming fd:n to avoid qemu holding fd indefinitely

Daniel P. Berrange berrange at redhat.com
Wed Mar 2 12:14:44 UTC 2011


On Tue, Mar 01, 2011 at 10:16:52PM -0700, Eric Blake wrote:
> On 01/03/2011 06:39 AM, Paolo Bonzini wrote:
> > On 12/23/2010 05:51 PM, Eric Blake wrote:
> >> In the outgoing direction, we still have to use a unix socket (outgoing
> >> migration is started via a monitor command, and I don't know how to pass
> >> a new fd into qemu for using with an fd:n outgoing migration via the
> >> monitor - it seems like fd is only useful on the command line).
> > 
> > See qemuMonitorCommandWithFd and qemuMonitorJSONCommandWithFd.
> 
> I'm looking at this problem again, now that we know that qemu exec:
> migration is inherently racy (see
> https://bugzilla.redhat.com/show_bug.cgi?id=678524).  I've managed to
> work out the code to send an fd over to qemu, but how do I formulate the
> fd:n migration command to use that fd?  That is, if I call
> qemuMonitorCommandWithFd(,20), that copies fd 20 from libvirt's point of
> view into qemu, but using the command 'migrate fd:20' is wrong because
> qemu's copy is not necessarily fd 20.

As Paolo mentions, file descriptors are passed by name in the monitor
args, instead of by number as they are on the command line. So if doing
a NIC on the command line libvirt would do

   -netdev  tap,fd=20

The corresponding monitor code would be

   getfd foo               (with SCM_RIGHTS for fd=20)
   netdev_add tap,fd=foo
   closefd foo             (only if we failed netdev_add stage)

So libvirt never needs to know what FD number QEMU sees.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list