[Libguestfs] [PATCH] appliance: reorder the steps to search for appliance

Richard W.M. Jones rjones at redhat.com
Tue Apr 25 15:33:47 UTC 2017


On Tue, Apr 25, 2017 at 06:13:37PM +0300, Pavel Butsykin wrote:
> On 25.04.2017 16:04, Richard W.M. Jones wrote:
> >Can you see what:
> >
> >   guestfish get-path
> 
> /usr/lib64/guestfs
> 
> >prints?  Are you setting LIBGUESTFS_PATH at all?
> >
> 
> No.
> 
> # ls /usr/lib64/guestfs
> initrd  kernel  README.fixed  root  supermin.d
> 
> libguestfs by default uses a single path to search fixed appliance and
> supermin.d. It seemed to me that the presence of options "--disable
> appliance --disable-daemon" must exclude the use of
> build_supermin_appliance.
> But libguestfs in any case trying to find supermin.d.

OK, I see - what's actually happening is that you've got a path which
is both a fixed appliance and a supermin appliance (although maybe it
only appears to be a supermin appliance -- libguestfs just looks for
the "supermin.d" entry and decides it's a supermin appliance).

> Maybe it's not
> quite right to make such decisions based on the contents of the
> directory.

Yes that's right, but see below.

> Also, I still don't understand what the priority of the search
> appliances was supposed to actually use. Because in the documentation
> the first step is to search for fixed appliance, but is actually
> supermin.d(for building appliance).

There's not a priority in this situation.  It wasn't intended that two
different appliances would be on the exact same path.

Some possible solutions:

(1) Make the check in lib/appliance.c: contains_supermin_appliance
more robust.

It could perhaps be changed so that it checks that at least
"base.tar.gz" and "packages" are found within the supermin.d
directory.  Those are the minimum two files that must be in a supermin
appliance (see supermin(8)).

(2) If the fixed appliance was located somewhere else, you could do:

  LIBGUESTFS_PATH=/path/to/somewhere/else:/usr/lib64/guestfs
  export LIBGUESTFS_PATH

and then it would look for the fixed appliance in
/path/to/somewhere/else and use it.  If the fixed appliance exists
there, then it would never check /usr/lib64/guestfs.

(3) You could also compile a different path into libguestfs.

Unfortunately there's no way to specify it at configure time, but see
GUESTFS_DEFAULT_PATH in the sources.

(4) Delete /usr/lib64/guestfs/supermin.d

Rich.

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




More information about the Libguestfs mailing list