[libvirt] [PATCH] Don't list capabilities entries if emulators can't be accessed

Jim Meyering jim at meyering.net
Thu Aug 21 08:56:06 UTC 2008


"Daniel P. Berrange" <berrange at redhat.com> wrote:
> On Wed, Aug 20, 2008 at 12:51:05PM -0400, Cole Robinson wrote:
>> The patch below fixes capabilities xml generation for
>> the qemu driver if the emulators aren't found in the
>> hardcoded paths. Current behavior will add a <guest>
>> entry for the emulator even if it does not exist, patch
>> fixes this to check that we actually have access.
>>
>> This brings up another issue, that hardcoded paths
>> aren't exactly distro friendly. I'm not really familiar
>> with what options we have to allow specifying these
>> at build time (or something else). Anyone have an
>> idea?
>
> Ideally we'd just list the binary names, and search in $PATH for them.
> Patches for this welcome...

The gnulib "findprog" module can be used to do this, but
there are two obstacles:
  - it's GPL (probably just because...
  - it exits on an out of memory error

However, it's not a big deal to rewrite it not to exit,
and make dependent modules will be LGPLv2+.  Will require
pulling the mfile_name_cat function out into its own module.
I'm working on this.

>> diff --git a/src/qemu_conf.c b/src/qemu_conf.c
>> index dc9e42a..0328cc1 100644
>> --- a/src/qemu_conf.c
>> +++ b/src/qemu_conf.c
>> @@ -230,6 +230,10 @@ qemudCapsInitGuest(virCapsPtr caps,
>>      virCapsGuestPtr guest;
>>      int i;
>>
>> +    /* Check for existance of base emulator */
>> +    if (access(info->binary, X_OK) == -1)
>> +        return 0;
>> +
>
> This isn't right - this means that if KVM is installed, but QEMU is
> not installed you won't get any capabilities.
>
> Basically we need todo all the access() checks for QEMU, KVM, /dev/kvm
> up-front. And then generated the capabilites if either QEMU or KVM is
> available.
>
> Daniel




More information about the libvir-list mailing list