qemu: Use FW descriptors to report FW image paths

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@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Michal Privoznik 2019-08-05 11:29:05 +02:00
parent 5a5b8f74d4
commit e9d51a221c

View File

@ -5181,12 +5181,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))
@ -5194,9 +5198,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;
}