[Libguestfs] --with-qemu option in libguestfs

Richard W.M. Jones rjones at redhat.com
Thu Oct 5 10:57:31 UTC 2017


On Thu, Oct 05, 2017 at 10:32:09AM +0000, emlyn.jose at wipro.com wrote:
> Hi Richard,
> 
> The --with-qemu option description is given as below:
> 
>   --with-qemu="bin1 bin2 ..."
>                           set default QEMU binary [default="[qemu-kvm]
>                           qemu-system-<host> qemu"]
> 
> Does specifying this option takes only these 3 binaries?

The ‘./configure --with-qemu=...’ option takes a list of possible qemu
binary names.  It searches the $PATH for each until it finds that name.

Libguestfs uses this for various things:

 - As a default setting for the hypervisor in the handle, which you
   can override at runtime:
   http://libguestfs.org/guestfs.3.html#guestfs_set_hv

 - At configure time we need to test various features of qemu,
   although generally speaking we are trying to reduce the need to
   test qemu features at compile time, preferring instead to test at
   runtime.  In fact most of the configure-time tests could now be
   dropped if we just assumed "new enough" qemu.

As a special case you can also do ‘./configure --without-qemu’ (or
‘./configure --with-qemu=no’ which is the same thing) which disables
qemu, although that means for libguestfs to work at all you would need
to supply a qemu binary at runtime through an environment variable
(‘LIBGUESTFS_HV=/path/to/qemu program’).

The logic for all this is here:

  https://github.com/libguestfs/libguestfs/blob/master/m4/guestfs_qemu.m4#L26

> I would like libguestfs to take even the "qemu-img" binary from the
> installed qemu package.
> How to enable that?

qemu is a hypervisor, qemu-img is a program for manipulating disk
images.  They are very different things, and it makes no sense to
substitute qemu-img for qemu.

However libguestfs does use qemu-img as well, and it gets it from
$PATH when run.  There is no configuration required, you just have to
make sure that qemu-img is on the $PATH when running any libguestfs
program that requires it.

> P.S: Its surprising to see that even after uninstalling the
> available qemu-img package from my host, libguestfs takes it without
> any issues!! Where does it take that "qemu-img" binary from?

>From $PATH.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list