diff --git a/0005-util-use-g_autofree-in-virSCSIHostGetUniqueId.patch b/0005-util-use-g_autofree-in-virSCSIHostGetUniqueId.patch new file mode 100644 index 0000000..e03e1c0 --- /dev/null +++ b/0005-util-use-g_autofree-in-virSCSIHostGetUniqueId.patch @@ -0,0 +1,57 @@ +From: =?UTF-8?q?J=C3=A1n=20Tomko?= +Date: Wed, 4 Nov 2020 12:08:19 +0100 +Subject: [PATCH] util: use g_autofree in virSCSIHostGetUniqueId +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Ján Tomko +Reviewed-by: Erik Skultety +(cherry picked from commit 843b70995471c1a20822ee62ff084310066b4b4a) +--- + src/util/virscsihost.c | 16 +++++----------- + 1 file changed, 5 insertions(+), 11 deletions(-) + +diff --git a/src/util/virscsihost.c b/src/util/virscsihost.c +index 7d8e5299b8..4e6d8f7ad6 100644 +--- a/src/util/virscsihost.c ++++ b/src/util/virscsihost.c +@@ -46,17 +46,16 @@ int + virSCSIHostGetUniqueId(const char *sysfs_prefix, + int host) + { +- char *sysfs_path = NULL; ++ g_autofree char *sysfs_path = NULL; + char *p = NULL; +- int ret = -1; +- char *buf = NULL; ++ g_autofree char *buf = NULL; + int unique_id; + + sysfs_path = g_strdup_printf("%s/host%d/unique_id", + sysfs_prefix ? sysfs_prefix : SYSFS_SCSI_HOST_PATH, host); + + if (virFileReadAll(sysfs_path, 1024, &buf) < 0) +- goto cleanup; ++ return -1; + + if ((p = strchr(buf, '\n'))) + *p = '\0'; +@@ -65,15 +64,10 @@ virSCSIHostGetUniqueId(const char *sysfs_prefix, + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to parse unique_id: %s"), buf); + +- goto cleanup; ++ return -1; + } + +- ret = unique_id; +- +- cleanup: +- VIR_FREE(sysfs_path); +- VIR_FREE(buf); +- return ret; ++ return unique_id; + } + + diff --git a/0006-util-quieten-virSCSIHostGetUniqueId.patch b/0006-util-quieten-virSCSIHostGetUniqueId.patch new file mode 100644 index 0000000..fb67011 --- /dev/null +++ b/0006-util-quieten-virSCSIHostGetUniqueId.patch @@ -0,0 +1,56 @@ +From: =?UTF-8?q?J=C3=A1n=20Tomko?= +Date: Wed, 4 Nov 2020 12:29:07 +0100 +Subject: [PATCH] util: quieten virSCSIHostGetUniqueId +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The only caller of this function ignores failure +and just sets the unique_id to -1. + +Failing to read the file is likely to the device no longer +being present, not a real error. + +Stop reporting errors in this function. + +https://bugzilla.redhat.com/show_bug.cgi?id=1692100 + +Signed-off-by: Ján Tomko +Reviewed-by: Erik Skultety +(cherry picked from commit 4a56278e770c972dbee7be5842b557de152a586e) +--- + src/util/virscsihost.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/util/virscsihost.c b/src/util/virscsihost.c +index 4e6d8f7ad6..b1d51b40d3 100644 +--- a/src/util/virscsihost.c ++++ b/src/util/virscsihost.c +@@ -41,6 +41,8 @@ VIR_LOG_INIT("util.scsi_host"); + * Read the value of the "scsi_host" unique_id file. + * + * Returns the value on success or -1 on failure. ++ * ++ * No errors are reported. + */ + int + virSCSIHostGetUniqueId(const char *sysfs_prefix, +@@ -54,16 +56,14 @@ virSCSIHostGetUniqueId(const char *sysfs_prefix, + sysfs_path = g_strdup_printf("%s/host%d/unique_id", + sysfs_prefix ? sysfs_prefix : SYSFS_SCSI_HOST_PATH, host); + +- if (virFileReadAll(sysfs_path, 1024, &buf) < 0) ++ if (virFileReadAllQuiet(sysfs_path, 1024, &buf) < 0) + return -1; + + if ((p = strchr(buf, '\n'))) + *p = '\0'; + + if (virStrToLong_i(buf, NULL, 10, &unique_id) < 0) { +- virReportError(VIR_ERR_INTERNAL_ERROR, +- _("unable to parse unique_id: %s"), buf); +- ++ VIR_DEBUG("unable to parse unique_id: '%s'", buf); + return -1; + } + diff --git a/0007-node_device-Use-udev-monitor-source.patch b/0007-node_device-Use-udev-monitor-source.patch new file mode 100644 index 0000000..825b516 --- /dev/null +++ b/0007-node_device-Use-udev-monitor-source.patch @@ -0,0 +1,46 @@ +From: Michal Privoznik +Date: Tue, 17 Nov 2020 12:56:39 +0100 +Subject: [PATCH] node_device: Use "udev" monitor source +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In v6.3.0-rc1~67 I've made a switch: instead of listening on udev +events the nodedev driver started listening for kernel events. +This was because when a device changes its name (e.g. NICs) we +will get "move" event with DEVPATH_OLD property set, which we can +then use to remove the old device and thus keep our internal list +up to date. The switch to "kernel" source was made because if the +old NICs naming (eth0, eth1, ...) is enabled (e.g. via +net.ifnames=0 on the kernel cmd line) then udev overwrites the +property with the new name making our internal list go out of +sync. Interestingly, when the od NICs naming is not enabled then +the DEVPATH_OLD contains the correct value. + +But as it turns out, "kernel" source might be missing some other +important properties, e.g. USB vendor/product IDs. Therefore, +switch back to "udev" source and wish the best of luck to users +using the old NICs naming. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1897625 +Fixes: 9a13704818e4a018723e0ec5b9e97b176f1c8584 +Signed-off-by: Michal Privoznik +Reviewed-by: Daniel P. Berrangé +(cherry picked from commit 7e67a136dab9034dd3cb2ed76fa90c524c800cde) +--- + src/node_device/node_device_udev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c +index ff558efb83..b7fbd42fa1 100644 +--- a/src/node_device/node_device_udev.c ++++ b/src/node_device/node_device_udev.c +@@ -1878,7 +1878,7 @@ nodeStateInitialize(bool privileged, + + virObjectLock(priv); + +- priv->udev_monitor = udev_monitor_new_from_netlink(udev, "kernel"); ++ priv->udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); + if (!priv->udev_monitor) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("udev_monitor_new_from_netlink returned NULL")); diff --git a/libvirt.spec b/libvirt.spec index 562a37a..ca4c655 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -218,7 +218,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 6.6.0 -Release: 4%{?dist} +Release: 5%{?dist} License: LGPLv2+ URL: https://libvirt.org/ @@ -233,6 +233,11 @@ Patch0001: 0001-util-Fix-logic-in-virFileSetCOW.patch Patch0002: 0002-virdevmapper-Don-t-cache-device-mapper-major.patch Patch0003: 0003-virdevmapper-Handle-kernel-without-device-mapper-sup.patch Patch0004: 0004-virdevmapper-Ignore-all-errors-when-opening-dev-mapp.patch +# Fix noisy log error 'Failed to open file ...unique_id...' (bz #1692100) +Patch0005: 0005-util-use-g_autofree-in-virSCSIHostGetUniqueId.patch +Patch0006: 0006-util-quieten-virSCSIHostGetUniqueId.patch +# Fix USB device error 'vendor cannot be 0' (bz #1897625) +Patch0007: 0007-node_device-Use-udev-monitor-source.patch Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} @@ -2001,6 +2006,10 @@ exit 0 %changelog +* Mon Dec 07 2020 Cole Robinson - 6.6.0-5 +- Fix noisy log error 'Failed to open file ...unique_id...' (bz #1692100) +- Fix USB device error 'vendor cannot be 0' (bz #1897625) + * Fri Dec 04 2020 Richard W.M. Jones - 6.10.0-2 - Build libvirt-daemon-kvm for riscv64.