[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] conf: rewrite filtering for capabilities lookup



On 08/03/2018 04:28 PM, Daniel P. Berrangé wrote:
> The virCapabilitiesDomainDataLookupInternal() is given a list of
> parameters representing the desired domain characteristics. It then has
> to look throught the capabilities to identify an acceptable match.
> 
> The virCapsDomainDataCompare() method is used for filtering out
> candidates which don't match the desired criteria. It is called
> primarily from the innermost loops and as such is doing many repeated
> checks. For example if architcture and os type were checked at the top
> level loop the two inner loops could be avoided entirely. If emulator
> and domain type were checked in the 2nd level loop the 3rd level loop
> can be avoided too.
> 
> This change thus removes the virCapsDomainDataCompare() method and puts
> suitable checks at the start of each loop to ensure it executes the
> minimal number of loop iterations possible. The code becomes clearer to
> understand as a nice side-effect.

Unfinished sen... ;-)

> 
> Signed-off-by: Daniel P. Berrangé <berrange redhat com>
> ---
>  src/conf/capabilities.c | 100 ++++++++++++++++++----------------------
>  1 file changed, 45 insertions(+), 55 deletions(-)
> 


> @@ -731,6 +720,7 @@ virCapabilitiesDomainDataLookupInternal(virCapsPtr caps,
>              goto error;
>          }
>  
> +        VIR_DEBUG("No match %s", virBufferCurrentContent(&buf));
>          virReportError(VIR_ERR_INVALID_ARG,
>                         _("could not find capabilities for %s"),
>                         virBufferCurrentContent(&buf));
> 

This debug is pretty useless because the error message is the same and
will be in the logs too.

ACK

Michal


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]