[Libguestfs] Connecting to existing guests / guestfsd

Richard W.M. Jones rjones at redhat.com
Thu Jan 27 13:03:53 UTC 2011


Thinking about the way we deal with "sessions" between the host and
the daemon in the guest over virtio-serial.  The current way this
works is as follows:

    Host                           Guest
    ----                           -----

  create socket
  start qemu
                                  start daemon
                                  open virtio device
               <--------------
  accept(2)

               ... operations ...

  close(2)
               -------------->
                                   read returns 0
                                   exit

For the case where guestfsd is running free as a daemon in a guest,
then we don't want it to just exit after the first connection.

virtio-serial and guestfsd only allow one connection on a channel at a
time (see: http://www.linux-kvm.org/page/Virtio-serial_API).

So we change this to:

    Host                           Guest
    ----                           -----

                                  start daemon

                                  open virtio device <-----+
                                  (blocks until            |
                                     accepted on host)     |
               <--------------                             |
  accept(2)                                                |
                                                           |
               ... operations ...                          |
                                                           |
  close(2)                                                 |
               -------------->                             |
                                   read returns 0          |
                                   close                   |
                                   partial reset of        |
                                     internal state        |
                                         |                 |
                                         +-----------------+

This is assuming my understanding of virtio-serial is correct.
I've not tried it yet.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list