Now that we have qemuFirmwareGetSupported() so that it also
returns a list of FW image paths, we can use it to report them in
domain capabilities instead of the old time default list.
Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1733940
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index db1fc31cd9..318cfcebf3 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5161,12 +5161,16 @@ virQEMUCapsFillDomainOSCaps(virDomainCapsOSPtr os,
virDomainCapsLoaderPtr capsLoader = &os->loader;
uint64_t autoFirmwares = 0;
bool secure = false;
+ virFirmwarePtr *firmwaresAlt = NULL;
+ size_t nfirmwaresAlt = 0;
+ int ret = -1;
os->supported = VIR_TRISTATE_BOOL_YES;
os->firmware.report = true;
if (qemuFirmwareGetSupported(machine, arch, privileged,
- &autoFirmwares, &secure, NULL, NULL) < 0)
+ &autoFirmwares, &secure,
+ &firmwaresAlt, &nfirmwaresAlt) < 0)
return -1;
if (autoFirmwares & (1ULL << VIR_DOMAIN_OS_DEF_FIRMWARE_BIOS))
@@ -5174,9 +5178,15 @@ virQEMUCapsFillDomainOSCaps(virDomainCapsOSPtr os,
if (autoFirmwares & (1ULL << VIR_DOMAIN_OS_DEF_FIRMWARE_EFI))
VIR_DOMAIN_CAPS_ENUM_SET(os->firmware, VIR_DOMAIN_OS_DEF_FIRMWARE_EFI);
- if (virQEMUCapsFillDomainLoaderCaps(capsLoader, secure, firmwares, nfirmwares) <
0)
- return -1;
- return 0;
+ if (virQEMUCapsFillDomainLoaderCaps(capsLoader, secure,
+ firmwaresAlt ? firmwaresAlt : firmwares,
+ firmwaresAlt ? nfirmwaresAlt : nfirmwares) <
0)
+ goto cleanup;
+
+ ret = 0;
+ cleanup:
+ virFirmwareFreeList(firmwaresAlt, nfirmwaresAlt);
+ return ret;
}
--
2.21.0