If the user has requested a specific firmware format, then
all firmware builds that are not in that format should be
ignored while looking for matches.
The legacy hardcoded firmware list predates firmware
descriptors and their "format" field, so we can safely
assume that all builds listed in there are in raw format.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/qemu/qemu_firmware.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index be6d8d4519..a0167f860c 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -1171,12 +1171,26 @@ qemuFirmwareMatchDomain(const virDomainDef *def,
flash->executable.format);
return false;
}
+ if (loader &&
+ STRNEQ(flash->executable.format,
virStorageFileFormatTypeToString(loader->format))) {
+ VIR_DEBUG("Discarding loader with mismatching flash format '%s'
!= '%s'",
+ flash->executable.format,
+ virStorageFileFormatTypeToString(loader->format));
+ return false;
+ }
if (flash->mode == QEMU_FIRMWARE_FLASH_MODE_SPLIT) {
if (STRNEQ(flash->nvram_template.format, "raw")) {
VIR_DEBUG("Discarding loader with unsupported nvram template format
'%s'",
flash->nvram_template.format);
return false;
}
+ if (loader && loader->nvram &&
+ STRNEQ(flash->nvram_template.format,
virStorageFileFormatTypeToString(loader->nvram->format))) {
+ VIR_DEBUG("Discarding loader with mismatching nvram template format
'%s' != '%s'",
+ flash->nvram_template.format,
+
virStorageFileFormatTypeToString(loader->nvram->format));
+ return false;
+ }
}
}
@@ -1424,6 +1438,12 @@ qemuFirmwareFillDomainLegacy(virQEMUDriver *driver,
return 0;
}
+ if (loader->format != VIR_STORAGE_FILE_RAW) {
+ VIR_DEBUG("Ignoring legacy entries for loader with flash format
'%s'",
+ virStorageFileFormatTypeToString(loader->format));
+ return 1;
+ }
+
for (i = 0; i < cfg->nfirmwares; i++) {
virFirmware *fw = cfg->firmwares[i];
--
2.39.1