From 94f306e5d52baa2ce4977056f93a75b1d934629c29eda3348fe7705659acac80 Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Thu, 9 Jan 2020 15:42:24 +0000 Subject: [PATCH] Accepting request 762258 from home:jfehlig:branches:Virtualization - qemu: Fix firmware auto detection 50d7465f-qemu-firmware1.patc, 57f9067c-qemu-firmware2.patch, 7c5264d2-qemu-firmware3.patch, 8e1804f9-qemu-firmware4.patch, 8fcee478-qemu-firmware5.patch boo#1157378, bsc#1159796 OBS-URL: https://build.opensuse.org/request/show/762258 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=793 --- ...stats-functions-from-the-qemu-driver.patch | 10 +- 50d7465f-qemu-firmware1.patch | 93 +++++++++ 57f9067c-qemu-firmware2.patch | 61 ++++++ 7c5264d2-qemu-firmware3.patch | 178 ++++++++++++++++++ 8e1804f9-qemu-firmware4.patch | 102 ++++++++++ 8fcee478-qemu-firmware5.patch | 51 +++++ libvirt.changes | 9 + libvirt.spec | 12 +- libxl-set-cach-mode.patch | 4 +- libxl-support-block-script.patch | 8 +- suse-libxl-disable-autoballoon.patch | 4 +- 11 files changed, 518 insertions(+), 14 deletions(-) create mode 100644 50d7465f-qemu-firmware1.patch create mode 100644 57f9067c-qemu-firmware2.patch create mode 100644 7c5264d2-qemu-firmware3.patch create mode 100644 8e1804f9-qemu-firmware4.patch create mode 100644 8fcee478-qemu-firmware5.patch diff --git a/0001-Extract-stats-functions-from-the-qemu-driver.patch b/0001-Extract-stats-functions-from-the-qemu-driver.patch index e214c11..cb43c73 100644 --- a/0001-Extract-stats-functions-from-the-qemu-driver.patch +++ b/0001-Extract-stats-functions-from-the-qemu-driver.patch @@ -213,7 +213,7 @@ Index: libvirt-5.10.0/src/libvirt_private.syms =================================================================== --- libvirt-5.10.0.orig/src/libvirt_private.syms +++ libvirt-5.10.0/src/libvirt_private.syms -@@ -697,6 +697,9 @@ virDomainConfNWFilterInstantiate; +@@ -699,6 +699,9 @@ virDomainConfNWFilterInstantiate; virDomainConfNWFilterTeardown; virDomainConfVMNWFilterTeardown; @@ -223,7 +223,7 @@ Index: libvirt-5.10.0/src/libvirt_private.syms # conf/interface_conf.h virInterfaceDefFormat; -@@ -1669,6 +1672,7 @@ virCgroupGetMemoryUsage; +@@ -1671,6 +1674,7 @@ virCgroupGetMemoryUsage; virCgroupGetMemSwapHardLimit; virCgroupGetMemSwapUsage; virCgroupGetPercpuStats; @@ -243,7 +243,7 @@ Index: libvirt-5.10.0/src/qemu/qemu_driver.c #include "domain_audit.h" #include "node_device_conf.h" #include "virpci.h" -@@ -20389,13 +20390,7 @@ qemuDomainGetStatsState(virQEMUDriverPtr +@@ -20388,13 +20389,7 @@ qemuDomainGetStatsState(virQEMUDriverPtr virTypedParamListPtr params, unsigned int privflags G_GNUC_UNUSED) { @@ -258,7 +258,7 @@ Index: libvirt-5.10.0/src/qemu/qemu_driver.c } -@@ -20596,17 +20591,7 @@ qemuDomainGetStatsCpuCgroup(virDomainObj +@@ -20595,17 +20590,7 @@ qemuDomainGetStatsCpuCgroup(virDomainObj if (!priv->cgroup) return 0; @@ -277,7 +277,7 @@ Index: libvirt-5.10.0/src/qemu/qemu_driver.c } -@@ -20763,76 +20748,15 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr +@@ -20762,76 +20747,15 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr return ret; } diff --git a/50d7465f-qemu-firmware1.patch b/50d7465f-qemu-firmware1.patch new file mode 100644 index 0000000..59cb209 --- /dev/null +++ b/50d7465f-qemu-firmware1.patch @@ -0,0 +1,93 @@ +commit 50d7465f3d5e7ee23af91059784bc51f4c316481 +Author: Michal Prívozník +Date: Fri Dec 13 15:41:16 2019 +0100 + + qemu_firmware: Pass virDomainDef into qemuFirmwareFillDomain() + + This function needs domain definition really, we don't need to + pass the whole domain object. This saves couple of dereferences + and characters esp. in more checks to come. + + Signed-off-by: Michal Privoznik + Reviewed-by: Cole Robinson + Reviewed-by: Daniel P. Berrangé + +Index: libvirt-5.10.0/src/qemu/qemu_firmware.c +=================================================================== +--- libvirt-5.10.0.orig/src/qemu/qemu_firmware.c ++++ libvirt-5.10.0/src/qemu/qemu_firmware.c +@@ -1204,7 +1204,7 @@ qemuFirmwareFetchParsedConfigs(bool priv + + int + qemuFirmwareFillDomain(virQEMUDriverPtr driver, +- virDomainObjPtr vm, ++ virDomainDefPtr def, + unsigned int flags) + { + VIR_AUTOSTRINGLIST paths = NULL; +@@ -1217,7 +1217,7 @@ qemuFirmwareFillDomain(virQEMUDriverPtr + if (!(flags & VIR_QEMU_PROCESS_START_NEW)) + return 0; + +- if (vm->def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_NONE) ++ if (def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_NONE) + return 0; + + if ((nfirmwares = qemuFirmwareFetchParsedConfigs(driver->privileged, +@@ -1225,7 +1225,7 @@ qemuFirmwareFillDomain(virQEMUDriverPtr + return -1; + + for (i = 0; i < nfirmwares; i++) { +- if (qemuFirmwareMatchDomain(vm->def, firmwares[i], paths[i])) { ++ if (qemuFirmwareMatchDomain(def, firmwares[i], paths[i])) { + theone = firmwares[i]; + VIR_DEBUG("Found matching firmware (description path '%s')", + paths[i]); +@@ -1236,7 +1236,7 @@ qemuFirmwareFillDomain(virQEMUDriverPtr + if (!theone) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("Unable to find any firmware to satisfy '%s'"), +- virDomainOsDefFirmwareTypeToString(vm->def->os.firmware)); ++ virDomainOsDefFirmwareTypeToString(def->os.firmware)); + goto cleanup; + } + +@@ -1245,10 +1245,10 @@ qemuFirmwareFillDomain(virQEMUDriverPtr + * likely that admin/FW manufacturer messed up. */ + qemuFirmwareSanityCheck(theone, paths[i]); + +- if (qemuFirmwareEnableFeatures(driver, vm->def, theone) < 0) ++ if (qemuFirmwareEnableFeatures(driver, def, theone) < 0) + goto cleanup; + +- vm->def->os.firmware = VIR_DOMAIN_OS_DEF_FIRMWARE_NONE; ++ def->os.firmware = VIR_DOMAIN_OS_DEF_FIRMWARE_NONE; + + ret = 0; + cleanup: +Index: libvirt-5.10.0/src/qemu/qemu_firmware.h +=================================================================== +--- libvirt-5.10.0.orig/src/qemu/qemu_firmware.h ++++ libvirt-5.10.0/src/qemu/qemu_firmware.h +@@ -45,7 +45,7 @@ qemuFirmwareFetchConfigs(char ***firmwar + + int + qemuFirmwareFillDomain(virQEMUDriverPtr driver, +- virDomainObjPtr vm, ++ virDomainDefPtr def, + unsigned int flags); + + int +Index: libvirt-5.10.0/src/qemu/qemu_process.c +=================================================================== +--- libvirt-5.10.0.orig/src/qemu/qemu_process.c ++++ libvirt-5.10.0/src/qemu/qemu_process.c +@@ -6289,7 +6289,7 @@ qemuProcessPrepareDomain(virQEMUDriverPt + goto cleanup; + + VIR_DEBUG("Prepare bios/uefi paths"); +- if (qemuFirmwareFillDomain(driver, vm, flags) < 0) ++ if (qemuFirmwareFillDomain(driver, vm->def, flags) < 0) + goto cleanup; + if (qemuDomainInitializePflashStorageSource(vm) < 0) + goto cleanup; diff --git a/57f9067c-qemu-firmware2.patch b/57f9067c-qemu-firmware2.patch new file mode 100644 index 0000000..8821dd2 --- /dev/null +++ b/57f9067c-qemu-firmware2.patch @@ -0,0 +1,61 @@ +commit 57f9067ca3efffcfbbc7cd3f435482b63f875b72 +Author: Michal Prívozník +Date: Tue Jan 7 10:10:02 2020 +0100 + + qemu_firmware: Introduce @want variable to qemuFirmwareMatchDomain() + + This simplifies condition when matching FW interface by having a + single line condition instead of multiline one. Also, it prepares + the code for future expansion. + + Signed-off-by: Michal Privoznik + Reviewed-by: Daniel P. Berrangé + +Index: libvirt-5.10.0/src/qemu/qemu_firmware.c +=================================================================== +--- libvirt-5.10.0.orig/src/qemu/qemu_firmware.c ++++ libvirt-5.10.0/src/qemu/qemu_firmware.c +@@ -930,22 +930,39 @@ qemuFirmwareMatchesMachineArch(const qem + } + + ++static qemuFirmwareOSInterface ++qemuFirmwareOSInterfaceTypeFromOsDefFirmware(virDomainOsDefFirmware fw) ++{ ++ switch (fw) { ++ case VIR_DOMAIN_OS_DEF_FIRMWARE_BIOS: ++ return QEMU_FIRMWARE_OS_INTERFACE_BIOS; ++ case VIR_DOMAIN_OS_DEF_FIRMWARE_EFI: ++ return QEMU_FIRMWARE_OS_INTERFACE_UEFI; ++ case VIR_DOMAIN_OS_DEF_FIRMWARE_NONE: ++ case VIR_DOMAIN_OS_DEF_FIRMWARE_LAST: ++ break; ++ } ++ ++ return QEMU_FIRMWARE_OS_INTERFACE_NONE; ++} ++ ++ + static bool + qemuFirmwareMatchDomain(const virDomainDef *def, + const qemuFirmware *fw, + const char *path) + { + size_t i; ++ qemuFirmwareOSInterface want; + bool supportsS3 = false; + bool supportsS4 = false; + bool requiresSMM = false; + bool supportsSEV = false; + ++ want = qemuFirmwareOSInterfaceTypeFromOsDefFirmware(def->os.firmware); ++ + for (i = 0; i < fw->ninterfaces; i++) { +- if ((def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_BIOS && +- fw->interfaces[i] == QEMU_FIRMWARE_OS_INTERFACE_BIOS) || +- (def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_EFI && +- fw->interfaces[i] == QEMU_FIRMWARE_OS_INTERFACE_UEFI)) ++ if (fw->interfaces[i] == want) + break; + } + diff --git a/7c5264d2-qemu-firmware3.patch b/7c5264d2-qemu-firmware3.patch new file mode 100644 index 0000000..0e546b5 --- /dev/null +++ b/7c5264d2-qemu-firmware3.patch @@ -0,0 +1,178 @@ +commit 7c5264d2bee6c0bce152f5159f70e525ef0d0ebc +Author: Michal Prívozník +Date: Tue Jan 7 10:34:03 2020 +0100 + + src: Introduce and use virDomainDefHasOldStyleUEFI() and virDomainDefHasOldStyleROUEFI() + + These functions are meant to replace verbose check for the old + style of specifying UEFI with a simple function call. + + Signed-off-by: Michal Privoznik + Reviewed-by: Daniel P. Berrangé + +Index: libvirt-5.10.0/src/bhyve/bhyve_driver.c +=================================================================== +--- libvirt-5.10.0.orig/src/bhyve/bhyve_driver.c ++++ libvirt-5.10.0/src/bhyve/bhyve_driver.c +@@ -714,8 +714,7 @@ bhyveConnectDomainXMLToNative(virConnect + if (def->os.bootloader == NULL && + def->os.loader) { + +- if ((def->os.loader->readonly != VIR_TRISTATE_BOOL_YES) || +- (def->os.loader->type != VIR_DOMAIN_LOADER_TYPE_PFLASH)) { ++ if (!virDomainDefHasOldStyleROUEFI(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Only read-only pflash is supported.")); + goto cleanup; +Index: libvirt-5.10.0/src/conf/domain_conf.c +=================================================================== +--- libvirt-5.10.0.orig/src/conf/domain_conf.c ++++ libvirt-5.10.0/src/conf/domain_conf.c +@@ -31400,6 +31400,22 @@ virDomainDefHasMdevHostdev(const virDoma + } + + ++bool ++virDomainDefHasOldStyleUEFI(const virDomainDef *def) ++{ ++ return def->os.loader && ++ def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_PFLASH; ++} ++ ++ ++bool ++virDomainDefHasOldStyleROUEFI(const virDomainDef *def) ++{ ++ return virDomainDefHasOldStyleUEFI(def) && ++ def->os.loader->readonly == VIR_TRISTATE_BOOL_YES; ++} ++ ++ + /** + * virDomainGraphicsDefHasOpenGL: + * @def: domain definition +Index: libvirt-5.10.0/src/conf/domain_conf.h +=================================================================== +--- libvirt-5.10.0.orig/src/conf/domain_conf.h ++++ libvirt-5.10.0/src/conf/domain_conf.h +@@ -3681,6 +3681,12 @@ bool + virDomainDefHasMdevHostdev(const virDomainDef *def); + + bool ++virDomainDefHasOldStyleUEFI(const virDomainDef *def); ++ ++bool ++virDomainDefHasOldStyleROUEFI(const virDomainDef *def); ++ ++bool + virDomainGraphicsDefHasOpenGL(const virDomainDef *def); + + bool +Index: libvirt-5.10.0/src/libvirt_private.syms +=================================================================== +--- libvirt-5.10.0.orig/src/libvirt_private.syms ++++ libvirt-5.10.0/src/libvirt_private.syms +@@ -297,6 +297,8 @@ virDomainDefHasManagedPR; + virDomainDefHasMdevHostdev; + virDomainDefHasMemballoon; + virDomainDefHasMemoryHotplug; ++virDomainDefHasOldStyleROUEFI; ++virDomainDefHasOldStyleUEFI; + virDomainDefHasUSB; + virDomainDefHasVcpusOffline; + virDomainDefHasVFIOHostdev; +Index: libvirt-5.10.0/src/libxl/libxl_conf.c +=================================================================== +--- libvirt-5.10.0.orig/src/libxl/libxl_conf.c ++++ libvirt-5.10.0/src/libxl/libxl_conf.c +@@ -546,8 +546,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr de + * future, Xen will support a user-specified firmware path. See + * http://lists.xenproject.org/archives/html/xen-devel/2016-03/msg01628.html + */ +- if (def->os.loader && +- def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_PFLASH) ++ if (virDomainDefHasOldStyleUEFI(def)) + b_info->u.hvm.bios = LIBXL_BIOS_TYPE_OVMF; + + if (def->emulator) { +Index: libvirt-5.10.0/src/libxl/xen_xl.c +=================================================================== +--- libvirt-5.10.0.orig/src/libxl/xen_xl.c ++++ libvirt-5.10.0/src/libxl/xen_xl.c +@@ -1235,11 +1235,9 @@ xenFormatXLOS(virConfPtr conf, virDomain + if (xenConfigSetString(conf, "builder", "hvm") < 0) + return -1; + +- if (def->os.loader && +- def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_PFLASH) { +- if (xenConfigSetString(conf, "bios", "ovmf") < 0) +- return -1; +- } ++ if (virDomainDefHasOldStyleUEFI(def) && ++ xenConfigSetString(conf, "bios", "ovmf") < 0) ++ return -1; + + if (def->os.slic_table && + xenConfigSetString(conf, "acpi_firmware", def->os.slic_table) < 0) +Index: libvirt-5.10.0/src/qemu/qemu_domain.c +=================================================================== +--- libvirt-5.10.0.orig/src/qemu/qemu_domain.c ++++ libvirt-5.10.0/src/qemu/qemu_domain.c +@@ -4968,8 +4968,7 @@ qemuDomainDefValidate(const virDomainDef + + /* On x86, UEFI requires ACPI */ + if ((def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_EFI || +- (def->os.loader && +- def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_PFLASH)) && ++ virDomainDefHasOldStyleUEFI(def)) && + ARCH_IS_X86(def->os.arch) && + def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ON) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", +@@ -4981,8 +4980,7 @@ qemuDomainDefValidate(const virDomainDef + if (def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_TRISTATE_SWITCH_ON && + def->os.arch == VIR_ARCH_AARCH64 && + (def->os.firmware != VIR_DOMAIN_OS_DEF_FIRMWARE_EFI && +- (!def->os.loader || +- def->os.loader->type != VIR_DOMAIN_LOADER_TYPE_PFLASH))) { ++ !virDomainDefHasOldStyleUEFI(def))) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("ACPI requires UEFI on this architecture")); + goto cleanup; +@@ -15545,12 +15543,9 @@ void + qemuDomainNVRAMPathGenerate(virQEMUDriverConfigPtr cfg, + virDomainDefPtr def) + { +- if (def->os.loader && +- def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_PFLASH && +- def->os.loader->readonly == VIR_TRISTATE_BOOL_YES && ++ if (virDomainDefHasOldStyleROUEFI(def) && + !def->os.loader->nvram) + qemuDomainNVRAMPathFormat(cfg, def, &def->os.loader->nvram); +- + } + + +@@ -15677,8 +15672,7 @@ qemuDomainInitializePflashStorageSource( + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) + return 0; + +- if (!def->os.loader || +- def->os.loader->type != VIR_DOMAIN_LOADER_TYPE_PFLASH) ++ if (!virDomainDefHasOldStyleUEFI(def)) + return 0; + + if (!(pflash0 = virStorageSourceNew())) +Index: libvirt-5.10.0/src/qemu/qemu_driver.c +=================================================================== +--- libvirt-5.10.0.orig/src/qemu/qemu_driver.c ++++ libvirt-5.10.0/src/qemu/qemu_driver.c +@@ -15129,8 +15129,7 @@ qemuDomainSnapshotPrepare(virDomainObjPt + * Avoid the issues by forbidding internal snapshot with pflash completely. + */ + if (found_internal && +- vm->def->os.loader && +- vm->def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_PFLASH) { ++ virDomainDefHasOldStyleUEFI(vm->def)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("internal snapshots of a VM with pflash based " + "firmware are not supported")); diff --git a/8e1804f9-qemu-firmware4.patch b/8e1804f9-qemu-firmware4.patch new file mode 100644 index 0000000..e76b2e8 --- /dev/null +++ b/8e1804f9-qemu-firmware4.patch @@ -0,0 +1,102 @@ +commit 8e1804f9f66f13ca1412d22bf1a957b6d55a2365 +Author: Michal Prívozník +Date: Tue Dec 17 17:45:50 2019 +0100 + + qemu_firmware: Try to autofill for old style UEFI specification + + While we discourage people to use the old style of specifying + UEFI for their domains (the old style is putting path to the FW + image under /domain/os/loader/ whilst the new one is using + /domain/os/@firmware), some applications might have not adapted + yet. They still rely on libvirt autofilling NVRAM path and + figuring out NVRAM template when using the old way (notably + virt-install does this). We must preserve backcompat for this + previously supported config approach. However, since we really + want distro maintainers to leave --with-loader-nvram configure + option and rely on JSON descriptors, we need to implement + autofilling of NVRAM template for the old way too. + + Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1782778 + RHEL: https://bugzilla.redhat.com/show_bug.cgi?id=1776949 + + Signed-off-by: Michal Privoznik + Reviewed-by: Daniel P. Berrangé + +Index: libvirt-5.10.0/src/qemu/qemu_firmware.c +=================================================================== +--- libvirt-5.10.0.orig/src/qemu/qemu_firmware.c ++++ libvirt-5.10.0/src/qemu/qemu_firmware.c +@@ -961,6 +961,21 @@ qemuFirmwareMatchDomain(const virDomainD + + want = qemuFirmwareOSInterfaceTypeFromOsDefFirmware(def->os.firmware); + ++ if (want == QEMU_FIRMWARE_OS_INTERFACE_NONE && ++ def->os.loader) { ++ want = qemuFirmwareOSInterfaceTypeFromOsDefFirmware(def->os.loader->type); ++ ++ if (fw->mapping.device != QEMU_FIRMWARE_DEVICE_FLASH || ++ STRNEQ(def->os.loader->path, fw->mapping.data.flash.executable.filename)) { ++ VIR_DEBUG("Not matching FW interface %s or loader " ++ "path '%s' for user provided path '%s'", ++ qemuFirmwareDeviceTypeToString(fw->mapping.device), ++ fw->mapping.data.flash.executable.filename, ++ def->os.loader->path); ++ return false; ++ } ++ } ++ + for (i = 0; i < fw->ninterfaces; i++) { + if (fw->interfaces[i] == want) + break; +@@ -1228,14 +1243,29 @@ qemuFirmwareFillDomain(virQEMUDriverPtr + qemuFirmwarePtr *firmwares = NULL; + ssize_t nfirmwares = 0; + const qemuFirmware *theone = NULL; ++ bool needResult = true; + size_t i; + int ret = -1; + + if (!(flags & VIR_QEMU_PROCESS_START_NEW)) + return 0; + +- if (def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_NONE) +- return 0; ++ /* Fill in FW paths if either os.firmware is enabled, or ++ * loader path was provided with no nvram varstore. */ ++ if (def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_NONE) { ++ /* This is horrific check, but loosely said, if UEFI ++ * image was provided by the old method (by specifying ++ * its path in domain XML) but no template for NVRAM was ++ * specified and the varstore doesn't exist ... */ ++ if (!virDomainDefHasOldStyleROUEFI(def) || ++ def->os.loader->templt || ++ virFileExists(def->os.loader->nvram)) ++ return 0; ++ ++ /* ... then we want to consult JSON FW descriptors first, ++ * but we don't want to fail if we haven't found a match. */ ++ needResult = false; ++ } + + if ((nfirmwares = qemuFirmwareFetchParsedConfigs(driver->privileged, + &firmwares, &paths)) < 0) +@@ -1251,9 +1281,16 @@ qemuFirmwareFillDomain(virQEMUDriverPtr + } + + if (!theone) { +- virReportError(VIR_ERR_OPERATION_FAILED, +- _("Unable to find any firmware to satisfy '%s'"), +- virDomainOsDefFirmwareTypeToString(def->os.firmware)); ++ if (needResult) { ++ virReportError(VIR_ERR_OPERATION_FAILED, ++ _("Unable to find any firmware to satisfy '%s'"), ++ virDomainOsDefFirmwareTypeToString(def->os.firmware)); ++ } else { ++ VIR_DEBUG("Unable to find NVRAM template for '%s', " ++ "falling back to old style", ++ NULLSTR(def->os.loader ? def->os.loader->path : NULL)); ++ ret = 0; ++ } + goto cleanup; + } + diff --git a/8fcee478-qemu-firmware5.patch b/8fcee478-qemu-firmware5.patch new file mode 100644 index 0000000..500304f --- /dev/null +++ b/8fcee478-qemu-firmware5.patch @@ -0,0 +1,51 @@ +commit 8fcee47807d29008632a7ad918cbe93ac0a20597 +Author: Michal Prívozník +Date: Wed Jan 8 09:42:47 2020 +0100 + + qemu_firmware: Accept int in qemuFirmwareOSInterfaceTypeFromOsDefFirmware() + + The point of this function is to translate virDomainOsDefFirmware + enum to qemuFirmwareOSInterface enum. However, with my commit + v5.10.0-507-g8e1804f9f6 we are passing a variable type of + virDomainLoader enum. Make the function accept both enums and + make the enum members correspond to each other. + + This fixes clang build. + + Signed-off-by: Michal Privoznik + Reviewed-by: Ján Tomko + +Index: libvirt-5.10.0/src/conf/domain_conf.h +=================================================================== +--- libvirt-5.10.0.orig/src/conf/domain_conf.h ++++ libvirt-5.10.0/src/conf/domain_conf.h +@@ -1927,12 +1927,14 @@ struct _virDomainOSEnv { + + typedef enum { + VIR_DOMAIN_OS_DEF_FIRMWARE_NONE = 0, +- VIR_DOMAIN_OS_DEF_FIRMWARE_BIOS, +- VIR_DOMAIN_OS_DEF_FIRMWARE_EFI, ++ VIR_DOMAIN_OS_DEF_FIRMWARE_BIOS = VIR_DOMAIN_LOADER_TYPE_ROM, ++ VIR_DOMAIN_OS_DEF_FIRMWARE_EFI = VIR_DOMAIN_LOADER_TYPE_PFLASH, + + VIR_DOMAIN_OS_DEF_FIRMWARE_LAST + } virDomainOsDefFirmware; + ++G_STATIC_ASSERT((int)VIR_DOMAIN_OS_DEF_FIRMWARE_LAST == (int)VIR_DOMAIN_LOADER_TYPE_LAST); ++ + VIR_ENUM_DECL(virDomainOsDefFirmware); + + struct _virDomainOSDef { +Index: libvirt-5.10.0/src/qemu/qemu_firmware.c +=================================================================== +--- libvirt-5.10.0.orig/src/qemu/qemu_firmware.c ++++ libvirt-5.10.0/src/qemu/qemu_firmware.c +@@ -931,7 +931,7 @@ qemuFirmwareMatchesMachineArch(const qem + + + static qemuFirmwareOSInterface +-qemuFirmwareOSInterfaceTypeFromOsDefFirmware(virDomainOsDefFirmware fw) ++qemuFirmwareOSInterfaceTypeFromOsDefFirmware(int fw) + { + switch (fw) { + case VIR_DOMAIN_OS_DEF_FIRMWARE_BIOS: diff --git a/libvirt.changes b/libvirt.changes index 3eae7b8..d2b7114 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Thu Jan 9 01:33:23 UTC 2020 - James Fehlig + +- qemu: Fix firmware auto detection + 50d7465f-qemu-firmware1.patc, 57f9067c-qemu-firmware2.patch, + 7c5264d2-qemu-firmware3.patch, 8e1804f9-qemu-firmware4.patch, + 8fcee478-qemu-firmware5.patch + boo#1157378, bsc#1159796 + ------------------------------------------------------------------- Thu Dec 19 15:11:02 UTC 2019 - James Fehlig diff --git a/libvirt.spec b/libvirt.spec index ffa491d..43f5512 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -1,7 +1,7 @@ # # spec file for package libvirt # -# Copyright (c) 2019 SUSE LLC +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -346,6 +346,11 @@ Source100: %{name}-rpmlintrc Patch0: 0a65cba4-news-fix.patch Patch1: 07aaced4-Add-TAA-No.patch Patch2: f411b7ef6-Add-TSX-CTRL.patch +Patch3: 50d7465f-qemu-firmware1.patch +Patch4: 57f9067c-qemu-firmware2.patch +Patch5: 7c5264d2-qemu-firmware3.patch +Patch6: 8e1804f9-qemu-firmware4.patch +Patch7: 8fcee478-qemu-firmware5.patch # Patches pending upstream review Patch100: libxl-dom-reset.patch Patch101: network-don-t-use-dhcp-authoritative-on-static-netwo.patch @@ -882,6 +887,11 @@ libvirt plugin for NSS for translating domain names into IP addresses. %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 %patch100 -p1 %patch101 -p1 %patch150 -p1 diff --git a/libxl-set-cach-mode.patch b/libxl-set-cach-mode.patch index 973e98b..9c2e41b 100644 --- a/libxl-set-cach-mode.patch +++ b/libxl-set-cach-mode.patch @@ -7,7 +7,7 @@ Index: libvirt-5.10.0/src/libxl/libxl_conf.c =================================================================== --- libvirt-5.10.0.orig/src/libxl/libxl_conf.c +++ libvirt-5.10.0/src/libxl/libxl_conf.c -@@ -869,6 +869,30 @@ libxlDiskSetDiscard(libxl_device_disk *x +@@ -868,6 +868,30 @@ libxlDiskSetDiscard(libxl_device_disk *x #endif } @@ -38,7 +38,7 @@ Index: libvirt-5.10.0/src/libxl/libxl_conf.c static char * libxlMakeNetworkDiskSrcStr(virStorageSourcePtr src, const char *username, -@@ -1110,6 +1134,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk +@@ -1109,6 +1133,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk x_disk->is_cdrom = l_disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM ? 1 : 0; if (libxlDiskSetDiscard(x_disk, l_disk->discard) < 0) return -1; diff --git a/libxl-support-block-script.patch b/libxl-support-block-script.patch index eeb627a..94cba1d 100644 --- a/libxl-support-block-script.patch +++ b/libxl-support-block-script.patch @@ -11,7 +11,7 @@ Index: libvirt-5.10.0/src/libxl/libxl_conf.c =================================================================== --- libvirt-5.10.0.orig/src/libxl/libxl_conf.c +++ libvirt-5.10.0/src/libxl/libxl_conf.c -@@ -869,6 +869,25 @@ libxlDiskSetDiscard(libxl_device_disk *x +@@ -868,6 +868,25 @@ libxlDiskSetDiscard(libxl_device_disk *x #endif } @@ -37,7 +37,7 @@ Index: libvirt-5.10.0/src/libxl/libxl_conf.c static void libxlDiskSetCacheMode(libxl_device_disk *x_disk, int cachemode) { -@@ -1009,6 +1028,7 @@ libxlMakeNetworkDiskSrc(virStorageSource +@@ -1008,6 +1027,7 @@ libxlMakeNetworkDiskSrc(virStorageSource int libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk) { @@ -45,7 +45,7 @@ Index: libvirt-5.10.0/src/libxl/libxl_conf.c const char *driver = virDomainDiskGetDriver(l_disk); int format = virDomainDiskGetFormat(l_disk); int actual_type = virStorageSourceGetActualType(l_disk->src); -@@ -1024,7 +1044,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk +@@ -1023,7 +1043,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk if (libxlMakeNetworkDiskSrc(l_disk->src, &x_disk->pdev_path) < 0) return -1; } else { @@ -54,7 +54,7 @@ Index: libvirt-5.10.0/src/libxl/libxl_conf.c } x_disk->vdev = g_strdup(l_disk->dst); -@@ -1135,6 +1155,9 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk +@@ -1134,6 +1154,9 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk if (libxlDiskSetDiscard(x_disk, l_disk->discard) < 0) return -1; libxlDiskSetCacheMode(x_disk, l_disk->cachemode); diff --git a/suse-libxl-disable-autoballoon.patch b/suse-libxl-disable-autoballoon.patch index 495754e..8ba5cad 100644 --- a/suse-libxl-disable-autoballoon.patch +++ b/suse-libxl-disable-autoballoon.patch @@ -31,7 +31,7 @@ Index: libvirt-5.10.0/src/libxl/libxl_conf.c =================================================================== --- libvirt-5.10.0.orig/src/libxl/libxl_conf.c +++ libvirt-5.10.0/src/libxl/libxl_conf.c -@@ -1704,15 +1704,12 @@ libxlMakeBuildInfoVfb(virPortAllocatorRa +@@ -1703,15 +1703,12 @@ libxlMakeBuildInfoVfb(virPortAllocatorRa /* * Get domain0 autoballoon configuration. Honor user-specified * setting in libxl.conf first. If not specified, autoballooning @@ -48,7 +48,7 @@ Index: libvirt-5.10.0/src/libxl/libxl_conf.c int res; res = virConfGetValueBool(conf, "autoballoon", &cfg->autoballoon); -@@ -1721,15 +1718,8 @@ libxlGetAutoballoonConf(libxlDriverConfi +@@ -1720,15 +1717,8 @@ libxlGetAutoballoonConf(libxlDriverConfi else if (res == 1) return 0;