[PATCH] qemuDomainDeviceNetDefPostParse: Switch order of conditions

Laine Stump laine at redhat.com
Thu Jun 25 13:47:05 UTC 2020


On 6/25/20 3:48 AM, Michal Privoznik wrote:
> A few commits back (in v6.4.0-131-gbdb8f2e418) the post parse
> function for domain interface was changed so that it doesn't fill
> in model for hostdev types of interfaces (including network type
> interfaces which would end up hostdevs).
>
> While the idea is sound, the execution can be a bit better:
> virDomainNetResolveActualType() which is used to determine
> runtime type of given interface is heavy gun - it connects to
> network driver, fetches network XML, parses it. This all is
> followed by check whether the interface doesn't already have
> model set (from domain XML).
>
> If we switch the order of these two checks then the short circuit
> evaluation will ensure the expensive check is done only if really
> needed.


Oops! I should have caught that when I reviewed the earlier commit.


Reviewed-by: Laine Stump <laine at redhat.com>





More information about the libvir-list mailing list