[libvirt] [PATCH 19/41] domcaps: Show only CPU models supported by libvirt

Jiri Denemark jdenemar at redhat.com
Wed Sep 14 09:29:46 UTC 2016


On Mon, Aug 29, 2016 at 18:01:21 -0400, John Ferlan wrote:
...
> My Coverity environment had a build failure here:
> 
> conf/domain_capabilities.c: In function 'virDomainCapsCPUModelsFilter':
> conf/domain_capabilities.c:183:48: error: passing argument 1 of
> 'virStringArrayHasString' from incompatible pointer type
> [-Werror=incompatible-pointer-types]
>          if (models && !virStringArrayHasString(models,
> old->models[i].name))
>                                                 ^~~~~~
> In file included from conf/domain_capabilities.c:28:0:
> ./util/virstring.h:47:6: note: expected 'const char **' but argument is
> of type 'char **'
>  bool virStringArrayHasString(const char **strings, const char *needle);
>       ^~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> Makefile:8092: recipe for target
> 'conf/libvirt_conf_la-domain_capabilities.lo' failed

Yeah, my compiler doesn't like this either. It's caused by a recent
change to virStringArrayHasString. Fixed.

> > @@ -4207,7 +4209,13 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps,
> >          domCaps->cpu.hostModel = virQEMUCapsGuestIsNative(caps->host.arch,
> >                                                            qemuCaps->arch);
> >  
> > -    domCaps->cpu.custom = virObjectRef(qemuCaps->cpuDefinitions);
> > +    if (qemuCaps->cpuDefinitions &&
> > +        cpuGetModels(domCaps->arch, &models) >= 0) {
> 
> if cpuGetModels returns 0, then models is empty so is there any point in
> making the call?

Yeah, currently there's no reason to call it if models is empty, but it
will change in the future :-)

That's what happens when splitting the changes into several patches once
a complete functionality has been implemented.

Jirka




More information about the libvir-list mailing list