qemu: don't continue loading caps if outdated

The XML format used for QEMU capabilities is not required to be
stable across releases, as we invalidate the cache whenever the
libvirt binary changes.

We none the less always try to parse te entire XML file before
we do any validity checks. Thus if we change the format of any
part of the data, or change permitted values for enums, then
libvirtd logs will be spammed with errors.

These are not in fact errors, but an expected scenario.

This change makes the loading code validate the cache timestamp
against the libvirtd timestamp immediately. If they don't match
then we stop loading the rest of the XML file.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé
2020-06-18 14:44:16 +01:00
parent e80eafa287
commit 66ce769d27
6 changed files with 61 additions and 36 deletions

View File

@@ -293,10 +293,9 @@ qemuTestParseCapabilitiesArch(virArch arch,
virArchToString(arch));
if (!(qemuCaps = virQEMUCapsNewBinary(binary)) ||
virQEMUCapsLoadCache(arch, qemuCaps, capsFile) < 0)
virQEMUCapsLoadCache(arch, qemuCaps, capsFile, true) < 0)
goto error;
virQEMUCapsSetInvalidation(qemuCaps, false);
return qemuCaps;
error: