Bug 1957040 - add a warning or a mention in devices/filter section that the devices file renders filters unusable
Summary: add a warning or a mention in devices/filter section that the devices file re...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: lvm2
Version: 8.5
Hardware: x86_64
OS: Linux
low
low
Target Milestone: beta
: ---
Assignee: David Teigland
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-04 21:54 UTC by Corey Marthaler
Modified: 2021-11-10 08:53 UTC (History)
9 users (show)

Fixed In Version: lvm2-2.03.12-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-09 19:45:25 UTC
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:4431 0 None None None 2021-11-09 19:45:43 UTC

Description Corey Marthaler 2021-05-04 21:54:03 UTC
Description of problem:
This rfe is solely for users who did not read the LVMDEVICES(8) man page which clearly states: 
"With no devices file, lvm will use any device on the system, and applies the filter to limit the full set of system devices.  With a devices file, the regex filter is  not  used,  and  the filter settings in lvm.conf or the command line are ignored."


LVMDEVICES(8)
With no devices file, lvm will use any device on the system, and applies the filter to limit the full set of system devices.  With a devices file, the regex filter is  not  used,  and  the filter settings in lvm.conf or the command line are ignored.  The vgimportdevices command is one exception which does apply the regex filter when looking for a VG to import.

# using a filter *without* a devices file
[root@hayes-01 ~]# pvcreate /dev/sd[bcd]1
  Physical volume "/dev/sdb1" successfully created.
  Physical volume "/dev/sdc1" successfully created.
  Physical volume "/dev/sdd1" successfully created.
[root@hayes-01 ~]# pvs
  PV         VG Fmt  Attr PSize  PFree 
  /dev/sdb1     lvm2 ---  <1.82t <1.82t
  /dev/sdc1     lvm2 ---  <1.82t <1.82t
  /dev/sdd1     lvm2 ---  <1.82t <1.82t
# filter
[root@hayes-01 ~]# pvs --config "devices {filter = [ \"r|/dev/sdb1|\" ]"}
  PV         VG Fmt  Attr PSize  PFree 
  /dev/sdc1     lvm2 ---  <1.82t <1.82t
  /dev/sdd1     lvm2 ---  <1.82t <1.82t


# using a filter *with* a devices file
[root@hayes-02 ~]# pvcreate /dev/sd[bcd]1
  Physical volume "/dev/sdb1" successfully created.
  Physical volume "/dev/sdc1" successfully created.
  Physical volume "/dev/sdd1" successfully created.
[root@hayes-02 ~]# pvs
  PV         VG Fmt  Attr PSize  PFree 
  /dev/sdb1     lvm2 ---  <1.82t <1.82t
  /dev/sdc1     lvm2 ---  <1.82t <1.82t
  /dev/sdd1     lvm2 ---  <1.82t <1.82t
# filter does nothing
[root@hayes-02 ~]# pvs --config "devices {filter = [ \"r|/dev/sdb1|\" ]"}
  PV         VG Fmt  Attr PSize  PFree 
  /dev/sdb1     lvm2 ---  <1.82t <1.82t
  /dev/sdc1     lvm2 ---  <1.82t <1.82t
  /dev/sdd1     lvm2 ---  <1.82t <1.82t

# add filter to lvm.conf
[root@hayes-02 ~]# grep filter /etc/lvm/lvm.conf 
        filter = [ "r|/dev/sdb1|" ]

# filter does nothing
[root@hayes-02 ~]# pvs
  PV         VG Fmt  Attr PSize  PFree 
  /dev/sdb1     lvm2 ---  <1.82t <1.82t
  /dev/sdc1     lvm2 ---  <1.82t <1.82t
  /dev/sdd1     lvm2 ---  <1.82t <1.82t


Version-Release number of selected component (if applicable):
lvm2-2.03.12-0.1.20210426git4dc5d4a.el8    BUILT: Mon Apr 26 08:23:33 CDT 2021
lvm2-libs-2.03.12-0.1.20210426git4dc5d4a.el8    BUILT: Mon Apr 26 08:23:33 CDT 2021

Comment 1 David Teigland 2021-05-05 19:04:15 UTC
fix
https://sourceware.org/git/?p=lvm2.git;a=commit;h=71933d3496dfb21e1e39744d69f0372e202c1a1c

"Please remove the lvm.conf filter, it is ignored with the devices file." and/or
"Please remove the lvm.conf global_filter, it is ignored with the devices file."

Comment 3 Richard W.M. Jones 2021-06-01 10:01:26 UTC
Would appreciate more than no notice at all of these kinds of changes.
This one breaks libguestfs:

https://bugzilla.redhat.com/show_bug.cgi?id=1965941

Also why was this change made in RHEL 9 first and is still not present in Fedora?

Comment 4 Corey Marthaler 2021-06-01 16:42:13 UTC
Marking Verified:Tested in the latest lvm rpms.

kernel-4.18.0-305.7.el8.kpq1    BUILT: Mon May 17 12:55:07 CDT 2021
lvm2-2.03.12-2.el8    BUILT: Tue Jun  1 06:55:37 CDT 2021
lvm2-libs-2.03.12-2.el8    BUILT: Tue Jun  1 06:55:37 CDT 2021
device-mapper-1.02.177-2.el8    BUILT: Tue Jun  1 06:55:37 CDT 2021
device-mapper-libs-1.02.177-2.el8    BUILT: Tue Jun  1 06:55:37 CDT 2021


[root@hayes-01 ~]# pvcreate /dev/sd[bcd]1
  Physical volume "/dev/sdb1" successfully created.
  Physical volume "/dev/sdc1" successfully created.
  Physical volume "/dev/sdd1" successfully created.
[root@hayes-01 ~]# vgcreate test  /dev/sd[bcd]1
  Volume group "test" successfully created

[root@hayes-01 ~]# cat /etc/lvm/devices/system.devices 
# LVM uses devices listed in this file.
# Created by LVM command vgcreate pid 19712 at Tue Jun  1 11:37:43 2021
VERSION=1.1.4
IDTYPE=sys_wwid IDNAME=naa.6d094660575ece002291b9e01bad8691 DEVNAME=/dev/sdb1 PVID=2X3FpGdn5uxksCIRsHxXidPLLWClO4Cp PART=1
IDTYPE=sys_wwid IDNAME=naa.6d094660575ece002291b958138a7c80 DEVNAME=/dev/sdc1 PVID=DYouy81lhPjr7I7WdDrHOhEDL5M3bVmq PART=1
IDTYPE=sys_wwid IDNAME=naa.6d094660575ece002291ba5c230d16c6 DEVNAME=/dev/sdd1 PVID=AVOOdnGSVBt6JCexF0bLdYc0YKNksuyz PART=1


[root@hayes-01 ~]# grep QA /etc/lvm/lvm.conf 
    filter = [ "r|/dev/sdc1$|" ]  # edited by QA test script qe_lvmconf (on Tue Jun  1 11:39:19 CDT 2021)!

[root@hayes-01 ~]# pvscan
  Please remove the lvm.conf filter, it is ignored with the devices file.
  PV /dev/sdb1   VG test            lvm2 [<1.82 TiB / <1.82 TiB free]
  PV /dev/sdc1   VG test            lvm2 [<1.82 TiB / <1.82 TiB free]
  PV /dev/sdd1   VG test            lvm2 [<1.82 TiB / <1.82 TiB free]
  Total: 3 [<5.46 TiB] / in use: 3 [<5.46 TiB] / in no VG: 0 [0   ]
[root@hayes-01 ~]# vgs
  Please remove the lvm.conf filter, it is ignored with the devices file.
  VG   #PV #LV #SN Attr   VSize  VFree 
  test   3   0   0 wz--n- <5.46t <5.46t

Comment 5 David Teigland 2021-06-01 17:31:02 UTC
(In reply to Richard W.M. Jones from comment #3)
> Would appreciate more than no notice at all of these kinds of changes.
> This one breaks libguestfs:
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1965941

Sorry about that, we should probably find a way to search for other packages that use lvm and might be affected, to avoid notification-by-breakage.  (We had some meetings with other groups last summer about this change but it was more about reviewing the planned design and features.)

> Also why was this change made in RHEL 9 first and is still not present in
> Fedora?

That would have been better, it will hopefully be enabled by default in fedora soon.

Comment 11 errata-xmlrpc 2021-11-09 19:45:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (lvm2 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4431


Note You need to log in before you can comment on or make changes to this bug.