]> git.ipfire.org Git - thirdparty/libvirt.git/commit
conf: rewrite filtering for capabilities lookup
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 2 Aug 2018 16:12:58 +0000 (17:12 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 10 Aug 2018 11:06:04 +0000 (12:06 +0100)
commit68dc579f438b35ff148e5617d48b1ae289391678
tree28ef8dd84411dc2798d7239ff4a54f45b2e97345
parent4669082f131cd6002c4637d2853099a45a877ff4
conf: rewrite filtering for capabilities lookup

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.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/conf/capabilities.c