diff --git a/libvirt.spec b/libvirt.spec index 49ee208c84643cc8bb9768df8bf7db27291910f8..bc5e82fef3495f9dcd19ddb53f2b77eaf8a5c2a1 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -99,7 +99,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 6.2.0 -Release: 12 +Release: 13 License: LGPLv2+ URL: https://libvirt.org/ @@ -156,6 +156,14 @@ Patch0045: libvirt-leaseshelper-Report-more-errors.patch Patch0046: libvirt-qemuBuildMemoryBackendProps-Use-boolean-type-for-pme.patch Patch0047: libvirt-qemu-format-ramfb-attribute-for-mediated-devices.patch Patch0048: libvirt-resctrl-Do-not-open-directory-for-writing.patch +Patch0049: libxl-fix-crash-when-initializing-driver.patch +Patch0050: util-fix-iteration-in-virSocketAddrResolveService.patch +Patch0051: qemu-fix-hang-in-p2p-xbzrle-compression-parallel-mig.patch +Patch0052: qemu-Revoke-access-to-mirror-on-failed-blockcopy.patch +Patch0053: qemuDomainDefPostParse-Fail-if-unable-to-fill-machin.patch +Patch0054: virNetDevGetFamilyId-Change-signature.patch +Patch0055: virNetDevSwitchdevFeature-Make-failure-to-get-family.patch +Patch0056: qemuDomainGetUnplugTimeout-Add-G_GNUC_NO_INLINE.patch Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} @@ -1888,6 +1896,8 @@ exit 0 %changelog +* Tue Sep 22 2020 AlexChen - 6.2.0-13 +- bugfix: cherry-pick some bugfix patches from opensource community * Tue Sep 22 2020 Hao Wang - 6.2.0-12 - backport upstream patches * Tue Sep 22 2020 Zeyu Jin - 6.2.0-11 diff --git a/libxl-fix-crash-when-initializing-driver.patch b/libxl-fix-crash-when-initializing-driver.patch new file mode 100644 index 0000000000000000000000000000000000000000..4d295c0435c4896aeda3057a0ec96123d11f745a --- /dev/null +++ b/libxl-fix-crash-when-initializing-driver.patch @@ -0,0 +1,48 @@ +From 0e95f7b912055cf254b71b0b02dcb0acf7da3870 Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Fri, 3 Apr 2020 15:51:48 -0600 +Subject: [PATCH 1/8] libxl: fix crash when initializing driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Commit 54a401af478 split out DriverConfigInit from DriverConfigNew, but +then called it a bit late from libxlStateInitialize. The cfg is used in +libxlDriverConfigLoadFile and when uninitialized results in a crash. +Calling DriverConfigInit immediately after DriverConfigNew fixes the +crash. + +Signed-off-by: Jim Fehlig +Reviewed-by: Erik Skultety +Reviewed-by: Ján Tomko +(cherry-picked from commit 88011ed2) +Signed-off-by: AlexChen +--- + src/libxl/libxl_driver.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c +index 7ec4fcc3d1..980984b199 100644 +--- a/src/libxl/libxl_driver.c ++++ b/src/libxl/libxl_driver.c +@@ -702,14 +702,14 @@ libxlStateInitialize(bool privileged, + if (!(cfg = libxlDriverConfigNew())) + goto error; + ++ if (libxlDriverConfigInit(cfg) < 0) ++ goto error; ++ + driverConf = g_strdup_printf("%s/libxl.conf", cfg->configBaseDir); + + if (libxlDriverConfigLoadFile(cfg, driverConf) < 0) + goto error; + +- if (libxlDriverConfigInit(cfg) < 0) +- goto error; +- + /* Register the callbacks providing access to libvirt's event loop */ + libxl_osevent_register_hooks(cfg->ctx, &libxl_osevent_callbacks, cfg->ctx); + +-- +2.23.0 + diff --git a/qemu-Revoke-access-to-mirror-on-failed-blockcopy.patch b/qemu-Revoke-access-to-mirror-on-failed-blockcopy.patch new file mode 100644 index 0000000000000000000000000000000000000000..2fadfadfc941a2478530240e7f49c876d8025efe --- /dev/null +++ b/qemu-Revoke-access-to-mirror-on-failed-blockcopy.patch @@ -0,0 +1,72 @@ +From 19d06bcb3c64662d5c131a035146d2caa8c5a437 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Tue, 14 Apr 2020 11:18:02 +0200 +Subject: [PATCH 4/8] qemu: Revoke access to mirror on failed blockcopy + +When preparing to do a blockcopy, the mirror image is modified so +that QEMU can access it. For instance, the mirror has seclabels +set, if it is a NVMe disk it is detached from the host and so on. +And usually, the restore is done upon successful finish of the +blockcopy operation. But, if something fails then we need to +explicitly revoke the access to the mirror image (and thus +reattach NVMe disk back to the host). + +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1822538 + +Signed-off-by: Michal Privoznik +Reviewed-by: Pavel Mores +(cherry-picked from commit 67e19fc9) +Signed-off-by: AlexChen +--- + src/qemu/qemu_driver.c | 21 +++++++++++++-------- + 1 file changed, 13 insertions(+), 8 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 8bc5368b2f..7162875492 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -17972,6 +17972,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, + virDomainDiskDefPtr disk = NULL; + int ret = -1; + bool need_unlink = false; ++ bool need_revoke = false; + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); + const char *format = NULL; + bool mirror_reuse = !!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT); +@@ -18146,6 +18147,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, + + if (qemuDomainStorageSourceChainAccessAllow(driver, vm, mirror) < 0) + goto endjob; ++ need_revoke = true; + + if (blockdev) { + if (mirror_reuse) { +@@ -18254,14 +18256,17 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, + + endjob: + if (ret < 0 && +- virDomainObjIsActive(vm) && +- (data || crdata)) { +- qemuDomainObjEnterMonitor(driver, vm); +- if (data) +- qemuBlockStorageSourceChainDetach(priv->mon, data); +- if (crdata) +- qemuBlockStorageSourceAttachRollback(priv->mon, crdata->srcdata[0]); +- ignore_value(qemuDomainObjExitMonitor(driver, vm)); ++ virDomainObjIsActive(vm)) { ++ if (data || crdata) { ++ qemuDomainObjEnterMonitor(driver, vm); ++ if (data) ++ qemuBlockStorageSourceChainDetach(priv->mon, data); ++ if (crdata) ++ qemuBlockStorageSourceAttachRollback(priv->mon, crdata->srcdata[0]); ++ ignore_value(qemuDomainObjExitMonitor(driver, vm)); ++ } ++ if (need_revoke) ++ qemuDomainStorageSourceChainAccessRevoke(driver, vm, mirror); + } + if (need_unlink && virStorageFileUnlink(mirror) < 0) + VIR_WARN("%s", _("unable to remove just-created copy target")); +-- +2.23.0 + diff --git a/qemu-fix-hang-in-p2p-xbzrle-compression-parallel-mig.patch b/qemu-fix-hang-in-p2p-xbzrle-compression-parallel-mig.patch new file mode 100644 index 0000000000000000000000000000000000000000..5905cf7e4b592b275230d86aa2f05fe23d90eeca --- /dev/null +++ b/qemu-fix-hang-in-p2p-xbzrle-compression-parallel-mig.patch @@ -0,0 +1,48 @@ +From f15935ea3b510bf0633dc2219a132412a7a8e96c Mon Sep 17 00:00:00 2001 +From: Lin Ma +Date: Thu, 16 Apr 2020 12:44:51 +0800 +Subject: [PATCH 3/8] qemu: fix hang in p2p + xbzrle compression + parallel + migration + +When we do parallel migration, The multifd-channels migration parameter +needs to be set on the destination side as well before incoming migration +URI, unless we accept the default number of connections(2). + +Usually, This can be correctly handled by libvirtd. But in this case if +we use p2p + xbzrle compression without parameter '--comp-xbzrle-cache', +qemuMigrationParamsDump returns too early, The corresponding migration +parameter will not be set on the destination side, It results QEMU hangs. + +Reproducer: +virsh migrate --live --p2p --comp-methods xbzrle \ +--parallel --parallel-connections 3 GUEST qemu+ssh://dsthost/system + +or + +virsh migrate --live --p2p --compressed \ +--parallel --parallel-connections 3 GUEST qemu+ssh://dsthost/system + +Signed-off-by: Lin Ma +Message-Id: <20200416044451.21134-1-lma@suse.com> +Reviewed-by: Jiri Denemark +(cherry-picked from commit 93b15ba0) +Signed-off-by: AlexChen +--- + src/qemu/qemu_migration_params.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c +index dd5e2ce1b6..810199370f 100644 +--- a/src/qemu/qemu_migration_params.c ++++ b/src/qemu/qemu_migration_params.c +@@ -630,7 +630,6 @@ qemuMigrationParamsDump(qemuMigrationParamsPtr migParams, + if (migParams->compMethods == 1ULL << QEMU_MIGRATION_COMPRESS_XBZRLE && + !migParams->params[QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE].set) { + *flags |= VIR_MIGRATE_COMPRESSED; +- return 0; + } + + for (i = 0; i < QEMU_MIGRATION_COMPRESS_LAST; ++i) { +-- +2.23.0 + diff --git a/qemuDomainDefPostParse-Fail-if-unable-to-fill-machin.patch b/qemuDomainDefPostParse-Fail-if-unable-to-fill-machin.patch new file mode 100644 index 0000000000000000000000000000000000000000..9a94a86f1092c3ca24779d27ebe8f80eb7a5beaf --- /dev/null +++ b/qemuDomainDefPostParse-Fail-if-unable-to-fill-machin.patch @@ -0,0 +1,47 @@ +From d9190851ed9a28e86d5baa3a9872eb6246270cd1 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Thu, 16 Apr 2020 14:18:28 +0200 +Subject: [PATCH 5/8] qemuDomainDefPostParse: Fail if unable to fill machine + type + +Previously, we used virCapabilitiesDomainDataLookup() to fill +machine type in post parse callback if none was provided in the +domain XML. If machine type couldn't be filled in an error was +reported. After 4a4132b4625 we've changed it to +virQEMUCapsGetPreferredMachine() which returns NULL, but we no +longer report an error and proceed with the post parse callbacks +processing. This may lead to a crash because the code later on +assumes def->os.machine is not NULL. + +Fixes: 4a4132b4625 + +Signed-off-by: Michal Privoznik +Reviewed-by: Pavel Mores +(cherry-picked from commit 67b973b5) +Signed-off-by: AlexChen +--- + src/qemu/qemu_domain.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index b1a46478ed..36e6343995 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -4971,6 +4971,14 @@ qemuDomainDefPostParse(virDomainDefPtr def, + if (!def->os.machine) { + const char *machine = virQEMUCapsGetPreferredMachine(qemuCaps, + def->virtType); ++ if (!machine) { ++ virReportError(VIR_ERR_INVALID_ARG, ++ _("could not get preferred machine for %s type=%s"), ++ def->emulator, ++ virDomainVirtTypeToString(def->virtType)); ++ return -1; ++ } ++ + def->os.machine = g_strdup(machine); + } + +-- +2.23.0 + diff --git a/qemuDomainGetUnplugTimeout-Add-G_GNUC_NO_INLINE.patch b/qemuDomainGetUnplugTimeout-Add-G_GNUC_NO_INLINE.patch new file mode 100644 index 0000000000000000000000000000000000000000..bb6fc8040e69cd5ebcffd1d8099c87caa5ad6527 --- /dev/null +++ b/qemuDomainGetUnplugTimeout-Add-G_GNUC_NO_INLINE.patch @@ -0,0 +1,33 @@ +From 9494102bc1560c1870c8ba603e936fa81beaa28c Mon Sep 17 00:00:00 2001 +From: Peter Krempa +Date: Thu, 23 Apr 2020 10:30:13 +0200 +Subject: [PATCH 8/8] qemuDomainGetUnplugTimeout: Add G_GNUC_NO_INLINE + +The function is mocked in qemuhotplugmock.so. Recent clang versions +decided to inline it so the mock stopped working resulting in +qemuhotplugtest wasting 15 seconds waiting for timeouts. + +Signed-off-by: Peter Krempa +Reviewed-by: Michal Privoznik +(cherry-picked from commit 2ab8dba5) +Signed-off-by: AlexChen +--- + src/qemu/qemu_hotplug.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c +index 14654a17d7..60d0729f1e 100644 +--- a/src/qemu/qemu_hotplug.c ++++ b/src/qemu/qemu_hotplug.c +@@ -5122,7 +5122,7 @@ qemuDomainResetDeviceRemoval(virDomainObjPtr vm) + } + + +-unsigned long long ++unsigned long long G_GNUC_NO_INLINE + qemuDomainGetUnplugTimeout(virDomainObjPtr vm) + { + if (qemuDomainIsPSeries(vm->def)) +-- +2.23.0 + diff --git a/util-fix-iteration-in-virSocketAddrResolveService.patch b/util-fix-iteration-in-virSocketAddrResolveService.patch new file mode 100644 index 0000000000000000000000000000000000000000..f60a90519af2d4578b8a0bd2144289593fbd672e --- /dev/null +++ b/util-fix-iteration-in-virSocketAddrResolveService.patch @@ -0,0 +1,31 @@ +From 9056229f9dff923406d97f0ac295bd502eaa5265 Mon Sep 17 00:00:00 2001 +From: Nikolay Shirokovskiy +Date: Mon, 13 Apr 2020 16:48:43 +0300 +Subject: [PATCH 2/8] util: fix iteration in virSocketAddrResolveService + +getaddrinfo returns linked list. Fix iteration accordingly. + +Signed-off-by: Nikolay Shirokovskiy +Reviewed-by: Daniel Henrique Barboza +(cherry-picked from commit a13ac587) +Signed-off-by: AlexChen +--- + src/util/virsocketaddr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c +index 4cad329d15..4c9f124e88 100644 +--- a/src/util/virsocketaddr.c ++++ b/src/util/virsocketaddr.c +@@ -271,7 +271,7 @@ int virSocketAddrResolveService(const char *service) + port = ntohs(in.sin6_port); + goto cleanup; + } +- tmp++; ++ tmp = tmp->ai_next; + } + + virReportError(VIR_ERR_SYSTEM_ERROR, +-- +2.23.0 + diff --git a/virNetDevGetFamilyId-Change-signature.patch b/virNetDevGetFamilyId-Change-signature.patch new file mode 100644 index 0000000000000000000000000000000000000000..2a0330c880189139b252cea34a169eef09d3dbba --- /dev/null +++ b/virNetDevGetFamilyId-Change-signature.patch @@ -0,0 +1,91 @@ +From 56635fe00f44f8c83ba059432d42c093be4e9ed8 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Sun, 19 Apr 2020 08:26:04 +0200 +Subject: [PATCH 6/8] virNetDevGetFamilyId: Change signature +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Introduced in v3.8.0-rc1~96, the virNetDevGetFamilyId() gets +netlink family ID for passed family name (even though it's used +only for getting "devlink" ID). Nevertheless, the function +returns 0 on an error or if no family ID was found. This makes it +harder for a caller to distinguish these two. Change the retval +so that a negative value is returned upon error, zero is no ID +found (but no error encountered) and a positive value is returned +on successful translation. + +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry-picked from commit ca616274) +Signed-off-by: AlexChen +--- + src/util/virnetdev.c | 23 +++++++++++++++-------- + 1 file changed, 15 insertions(+), 8 deletions(-) + +diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c +index b465bdac2e..3431aaf6a9 100644 +--- a/src/util/virnetdev.c ++++ b/src/util/virnetdev.c +@@ -3057,11 +3057,15 @@ virNetDevGetEthtoolFeatures(virBitmapPtr bitmap, + * This function supplies the devlink family id + * + * @family_name: the name of the family to query ++ * @family_id: family ID + * +- * Returns family id or 0 on failure. ++ * Returns: 0 if no family was found, ++ * 1 if family was found (@family_id is set), ++ * -1 otherwise + */ +-static uint32_t +-virNetDevGetFamilyId(const char *family_name) ++static int ++virNetDevGetFamilyId(const char *family_name, ++ uint32_t *family_id) + { + struct nl_msg *nl_msg = NULL; + struct nlmsghdr *resp = NULL; +@@ -3072,7 +3076,7 @@ virNetDevGetFamilyId(const char *family_name) + }; + struct nlattr *tb[CTRL_ATTR_MAX + 1] = {NULL, }; + unsigned int recvbuflen; +- uint32_t family_id = 0; ++ int ret = -1; + + if (!(nl_msg = nlmsg_alloc_simple(GENL_ID_CTRL, + NLM_F_REQUEST | NLM_F_ACK))) { +@@ -3098,15 +3102,18 @@ virNetDevGetFamilyId(const char *family_name) + goto cleanup; + } + +- if (tb[CTRL_ATTR_FAMILY_ID] == NULL) ++ if (tb[CTRL_ATTR_FAMILY_ID] == NULL) { ++ ret = 0; + goto cleanup; ++ } + +- family_id = *(uint32_t *)RTA_DATA(tb[CTRL_ATTR_FAMILY_ID]); ++ *family_id = *(uint32_t *)RTA_DATA(tb[CTRL_ATTR_FAMILY_ID]); ++ ret = 1; + + cleanup: + nlmsg_free(nl_msg); + VIR_FREE(resp); +- return family_id; ++ return ret; + } + + +@@ -3140,7 +3147,7 @@ virNetDevSwitchdevFeature(const char *ifname, + int ret = -1; + uint32_t family_id; + +- if ((family_id = virNetDevGetFamilyId(DEVLINK_GENL_NAME)) <= 0) ++ if (virNetDevGetFamilyId(DEVLINK_GENL_NAME, &family_id) <= 0) + return ret; + + if ((is_vf = virNetDevIsVirtualFunction(ifname)) < 0) +-- +2.23.0 + diff --git a/virNetDevSwitchdevFeature-Make-failure-to-get-family.patch b/virNetDevSwitchdevFeature-Make-failure-to-get-family.patch new file mode 100644 index 0000000000000000000000000000000000000000..2934d73cdb45cdd3e9a14cedc96e047900d41bd9 --- /dev/null +++ b/virNetDevSwitchdevFeature-Make-failure-to-get-family.patch @@ -0,0 +1,58 @@ +From 7581a0bbd552d63d654a88f0ad2a68e99fa8b54a Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Sun, 19 Apr 2020 07:25:34 +0200 +Subject: [PATCH 7/8] virNetDevSwitchdevFeature: Make failure to get + 'family_id' non-fatal +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +I've just got a new machine and I'm still converging on the +kernel config. Anyway, since I don't have enabled any of SRIO-V +drivers, my kernel doesn't have NET_DEVLINK enabled (i.e. +virNetDevGetFamilyId() returns 0). But this makes nodedev driver +ignore all interfaces, because when enumerating all devices via +udev, the control reaches virNetDevSwitchdevFeature() eventually +and subsequently virNetDevGetFamilyId() which 'fails'. Well, it's +not really a failure - the virNetDevSwitchdevFeature() stub +simply returns 0. + +Also, move the call a few lines below, just around the place +where it's needed. + +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry-picked from commit 423664a6) +Signed-off-by: AlexChen +--- + src/util/virnetdev.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c +index 3431aaf6a9..ff86aa1fc9 100644 +--- a/src/util/virnetdev.c ++++ b/src/util/virnetdev.c +@@ -3146,9 +3146,7 @@ virNetDevSwitchdevFeature(const char *ifname, + int is_vf = -1; + int ret = -1; + uint32_t family_id; +- +- if (virNetDevGetFamilyId(DEVLINK_GENL_NAME, &family_id) <= 0) +- return ret; ++ int rv; + + if ((is_vf = virNetDevIsVirtualFunction(ifname)) < 0) + return ret; +@@ -3168,6 +3166,9 @@ virNetDevSwitchdevFeature(const char *ifname, + goto cleanup; + } + ++ if ((rv = virNetDevGetFamilyId(DEVLINK_GENL_NAME, &family_id)) <= 0) ++ return rv; ++ + if (!(nl_msg = nlmsg_alloc_simple(family_id, + NLM_F_REQUEST | NLM_F_ACK))) { + virReportOOMError(); +-- +2.23.0 +