[Libguestfs] [PATCH 0/7] Add libvirt domain to core API

Richard W.M. Jones rjones at redhat.com
Wed Nov 10 11:44:42 UTC 2010


This series of patches aim to make adding disks from libvirt domains
easy through the core API.

These two new APIs allow you to add the disks from a libvirt domain.
The higher level add-domain API takes the name of the libvirt domain
as a string and connects to libvirt itself.  The lower level
add-libvirt-dom API relies on the program to connect to libvirt and
pass the virDomainPtr into the API call.

  int guestfs_add_domain (guestfs_h *g, const char *dom, ...);
  int guestfs_add_libvirt_dom (guestfs_h *g, virDomainPtr dom, ...);

In guestfish you can use the 'domain' command to access the higher
level API, eg:
    
  ><fs> domain Fedora14 libvirturi:qemu:///system
  1

(The returned number is the number of disks that were added.)

Since it would be impossible for the user to create a virDomainPtr
inside guestfish, the lower-level API is not exposed.

The 'guestfish -d' option is reimplemented to use this new API,
simplifying guestfish (and guestmount) and meaning that these programs
no longer directly depend on libvirt or libxml2.

As well as that I wanted libvirt and libxml2 to be optional
dependencies.  Distro packagers shouldn't need them in order to
compile libguestfs.  So I took the opportunity to make those optional,
and at the same time to make pcre, libmagic and hivex optional.  Of
course if you don't have those dependencies then certain core API
features are disabled.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw




More information about the Libguestfs mailing list