[libvirt] libguestfs integration: rich disk access for libvirt applications

Richard W.M. Jones rjones at redhat.com
Tue Sep 27 11:21:05 UTC 2011

On Tue, Sep 27, 2011 at 10:34:19AM +0100, Richard W.M. Jones wrote:
> (3) libvirtd runs the libguestfs appliance.  It forwards the socket
> back to us over the libvirt connection.  I think this is what Dan had
> in mind, and it's reasonably easy to integrate this into both libvirtd
> and libguestfs.

[To explain this option in more detail]

(a) Modify guestfs_add_domain in the case where the libvirt connection
is remote.  How do we know if the libvirt connection is remote?


As Dan pointed out elsewhere, any libvirt URI that has a host element
is probably "remote" even if the host element is "localhost" (since
that might indicate some sort of cross-user/-policy access).

(b) Add a libvirt API to open up a remote libguestfs.  Something like

  int virConnectStartGuestfsDaemon (
           virConnectPtr conn,       /* libvirt connection */
           const char *unix_path,    /* path to local unix domain socket */
           unsigned int flags

(c) At the remote end, libvirtd launches the libguestfs appliance in qemu.

  - How would it do this?
  - Would it reuse libguestfs code for this?
  - Would it call febootstrap-supermin-helper itself?  Or another method?
  - Do we need to pass any libguestfs parameters over (eg. path? qemu?
    verbose? append? memsize? selinux?)
  - Where do qemu log messages go to?

(d) The virtio serial port is forwarded back to the libvirt client
side, causing the Unix domain socket to be opened.

(e) The libguestfs library now calls guestfs_set_attach_method with
the name of the socket.

(f) The libguestfs tool works away as before.  (No change to the tool
or API, which is good).

(g) guestfs_close closes the socket.

  - Does libvirt detect this automatically?
  - Do we need to take some action to knock down the forwarding?


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org

More information about the libvir-list mailing list