mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 09:17:52 +03:00
qemu: Don't pick firmware with unsupported format
Right now, if the descriptor with the highest priority happens to describe a firmware in a format other than raw, no domain that uses autoselection will be able to start. A better approach is to filter out descriptors that advertise unsupported formats during autoselection. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
22d0b644de
commit
4b2d79fa7f
@ -1130,6 +1130,19 @@ qemuFirmwareMatchDomain(const virDomainDef *def,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (STRNEQ(flash->executable.format, "raw")) {
|
||||||
|
VIR_DEBUG("Discarding loader with unsupported flash format '%s'",
|
||||||
|
flash->executable.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 (def->sec) {
|
if (def->sec) {
|
||||||
@ -1183,24 +1196,10 @@ qemuFirmwareEnableFeatures(virQEMUDriver *driver,
|
|||||||
loader->type = VIR_DOMAIN_LOADER_TYPE_PFLASH;
|
loader->type = VIR_DOMAIN_LOADER_TYPE_PFLASH;
|
||||||
loader->readonly = VIR_TRISTATE_BOOL_YES;
|
loader->readonly = VIR_TRISTATE_BOOL_YES;
|
||||||
|
|
||||||
if (STRNEQ(flash->executable.format, "raw")) {
|
|
||||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
|
||||||
_("unsupported flash format '%s'"),
|
|
||||||
flash->executable.format);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
VIR_FREE(loader->path);
|
VIR_FREE(loader->path);
|
||||||
loader->path = g_strdup(flash->executable.filename);
|
loader->path = g_strdup(flash->executable.filename);
|
||||||
|
|
||||||
if (flash->mode == QEMU_FIRMWARE_FLASH_MODE_SPLIT) {
|
if (flash->mode == QEMU_FIRMWARE_FLASH_MODE_SPLIT) {
|
||||||
if (STRNEQ(flash->nvram_template.format, "raw")) {
|
|
||||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
|
||||||
_("unsupported nvram template format '%s'"),
|
|
||||||
flash->nvram_template.format);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!loader->nvram) {
|
if (!loader->nvram) {
|
||||||
loader->nvram = virStorageSourceNew();
|
loader->nvram = virStorageSourceNew();
|
||||||
loader->nvram->type = VIR_STORAGE_TYPE_FILE;
|
loader->nvram->type = VIR_STORAGE_TYPE_FILE;
|
||||||
|
Loading…
Reference in New Issue
Block a user