qemuTestCapsCacheInsert*: Directly insert real capabilities

Real capabilities populate the binary name, while fake don't. We can
directly insert the capabilities using the real binary name.

This will allow to remove 'qemu_emulators' entries once all tests are
converted to real capabilties.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2023-03-02 17:59:09 +01:00
parent f0fec72e3f
commit 5810eb97ad

View File

@ -533,6 +533,11 @@ qemuTestCapsCacheInsertImpl(virFileCache *cache,
*
* before populating the cache;
*/
/* caps->binary is populated only for real capabilities */
if (virQEMUCapsGetBinary(caps)) {
if (qemuTestCapsCacheInsertData(cache, virQEMUCapsGetBinary(caps), caps) < 0)
return -1;
} else {
virArch arch = virQEMUCapsGetArch(caps);
g_autoptr(virQEMUCaps) copyCaps = NULL;
virQEMUCaps *effCaps = caps;
@ -552,6 +557,7 @@ qemuTestCapsCacheInsertImpl(virFileCache *cache,
if (qemuTestCapsCacheInsertData(cache, qemu_emulators[arch], effCaps) < 0)
return -1;
}
}
} else {
/* in case when caps are missing or are missing architecture, we populate
* everything */