Accepting request 868529 from Base:System

OBS-URL: https://build.opensuse.org/request/show/868529
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/lvm2?expand=0&rev=144
This commit is contained in:
Dominique Leuenberger 2021-02-07 14:14:04 +00:00 committed by Git OBS Bridge
commit abb3e3873b
3 changed files with 76 additions and 2 deletions

View File

@ -0,0 +1,66 @@
From: Martin Wilck <mwilck@suse.com>
Subject: [PATCH] config: set external_device_info_source=none if udev isn't running
Date: Wed, 27 Jan 2021 18:28:59 +0100
Message-Id: <20210127172859.956-1-mwilck@suse.com>
LVM2 has several configuration options related to device detection
and udev. In particular, we have obtain_device_list_from_udev=(0|1)
and external_device_info_source=("none"|"udev"). The two options are
obviously semantically related, but it's rather unclear if and how
they interact.
If udev is unavailable, e.g. in containers, obtain_device_list_from_udev
(which defaults to 1) will be automatically reset to 0. However,
if external_device_info_source="udev" is set, this setting is not
reset to "none", leading to error messages like
Udev database has incomplete information about device /dev/vda.
/dev/vda: Failed to get external handle [udev].
This patch changes that, treating external_device_info_source the
same way as obtain_device_list_from_udev, thereby making LVM2's
device detection more consistent.
The default for external_device_info_source is "none", but I believe
there are very good reasons to change this setting to "udev", because
LVM will get detection of multipath and md devices wrong most of the
time otherwise. LVM should follow the same logic as systemd and other
system components with respect to device detection.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Heming Zhao <heming.zhao@suse.com>,
---
lib/commands/toolcontext.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 63b6811..55f6806 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -598,9 +598,20 @@ static int _process_config(struct cmd_context *cmd)
dev_ext_info_src = find_config_tree_str(cmd, devices_external_device_info_source_CFG, NULL);
if (dev_ext_info_src && !strcmp(dev_ext_info_src, "none"))
init_external_device_info_source(DEV_EXT_NONE);
- else if (dev_ext_info_src && !strcmp(dev_ext_info_src, "udev"))
- init_external_device_info_source(DEV_EXT_UDEV);
- else {
+ else if (dev_ext_info_src && !strcmp(dev_ext_info_src, "udev")) {
+ /*
+ * Override existing config and hardcode external_device_info_source==none if:
+ * - udev is not running
+ * - udev is disabled using DM_DISABLE_UDEV environment variable
+ * See also treatment of obtain_device_list_from_udev in _init_dev_cache()
+ */
+ if (udev_is_running())
+ init_external_device_info_source(DEV_EXT_UDEV);
+ else {
+ log_notice("udev is not running. Using external_device_info_source==none");
+ init_external_device_info_source(DEV_EXT_NONE);
+ }
+ } else {
log_error("Invalid external device info source specification.");
return 0;
}
--
2.29.2

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Feb 02 03:49:00 UTC 2021 - heming.zhao@suse.com
- lvm2 should use 'external_device_info_source="udev"' by default (bsc#1179691)
- add SUSE special patch to void issues in non udev env
+ bug-1179691_config-set-external_device_info_source-none.patch
-------------------------------------------------------------------
Mon Dec 09 01:16:00 UTC 2020 - heming.zhao@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package lvm2
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -61,7 +61,6 @@ Source1: lvm.conf
Source42: ftp://sourceware.org/pub/lvm2/LVM2.%{version}.tgz.asc
Source99: baselibs.conf
# Upstream patches
# n/a
Patch0001: bug-1175565_01-tools-move-struct-element-before-variable-lenght-lis.patch
Patch0002: bug-1175565_02-gcc-change-zero-sized-array-to-fexlible-array.patch
Patch0003: bug-1175565_03-gcc-zero-sized-array-to-fexlible-array-C99.patch
@ -72,6 +71,7 @@ Patch1002: fate-309425_display-dm-name-for-lv-name.patch
Patch1003: fate-31841_fsadm-add-support-for-btrfs.patch
Patch1004: bug-935623_dmeventd-fix-dso-name-wrong-compare.patch
Patch1005: bug-998893_make_pvscan_service_after_multipathd.patch
Patch1006: bug-1179691_config-set-external_device_info_source-none.patch
# SUSE patches 2000+ for device mapper, udev rules
Patch2001: bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-metadata.patch
# SUSE patches 3000+ for test code
@ -128,6 +128,7 @@ Volume Manager.
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch2001 -p1
%if !%{with lockd}