Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2052064

Summary: "Devices file /dev/sd* is excluded: device is partitioned" suggestion should be given for mpath devices as well
Product: Red Hat Enterprise Linux 8 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: LVM and device-mapper development team <lvm-team>
lvm2 sub component: Devices, Filtering and Stacking QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: unspecified CC: agk, heinzm, jbrassow, mcsontos, msnitzer, prajnoha, teigland, zkabelac
Version: 8.6Keywords: Reopened, Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.03.14-4.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-08 10:55:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Corey Marthaler 2022-02-08 15:48:17 UTC
Description of problem:

At first, I thought these partitioned devices shouldn't even be allowed to be added since they're unable to be used by LVM to make PVs. Second, the use of  "excluded by filter" in a warning is confusing in a post devicesfile lvm era, as we no longer support filters I thought. Third, I originally read "Remove partitioned device /dev/sdc from devices file." as LVM was removing it for me but then later realized LVM is telling me to do so manually. So, at a minimum, the mpath pvcreate attempt should also have that warning. As an RFE, should lvmdevices fail to add these partitioned devices? Should LVM automatically remove the devicesfile entry? Should there be no mention of filters, and instead just state that partitioned devices are unusable?



[root@hayes-02 ~]# cat /etc/lvm/devices/system.devices
# LVM uses devices listed in this file.
# Created by LVM command pvremove pid 29036 at Tue Feb  8 09:22:41 2022
VERSION=1.1.773


# This sd device is partitioned
[root@hayes-02 ~]# lvmdevices --adddev /dev/sdc
  WARNING: adding device /dev/sdc that is excluded by filter: device is partitioned.
[root@hayes-02 ~]# echo $?
0

# This mpath device is partitioned
[root@hayes-02 ~]# lvmdevices --adddev /dev/mapper/mpatha
  WARNING: adding device /dev/mapper/mpatha that is excluded by filter: device is partitioned.
[root@hayes-02 ~]# echo $?
0



[root@hayes-02 ~]# cat /etc/lvm/devices/system.devices
# LVM uses devices listed in this file.
# Created by LVM command lvmdevices pid 29100 at Tue Feb  8 09:23:45 2022
VERSION=1.1.775
IDTYPE=sys_wwid IDNAME=naa.6d094660650d1e0022bd29ee1e0945a8 DEVNAME=/dev/sdc PVID=.
IDTYPE=mpath_uuid IDNAME=mpath-36d094660650d1e0022bd29e81db0cefc DEVNAME=/dev/mapper/mpatha PVID=.


# LVM properly doesn't allow the PV creation of these devices. Should we alter the warning/error to not include "filtering"?
[root@hayes-02 ~]# pvcreate /dev/sdc
  Devices file /dev/sdc is excluded by filter: device is partitioned.
  Devices file /dev/mapper/mpatha is excluded by filter: device is partitioned.
  Cannot use /dev/sdc: device is partitioned
[root@hayes-02 ~]# pvcreate /dev/mapper/mpatha
  Devices file /dev/sdc is excluded by filter: device is partitioned.
  Devices file /dev/mapper/mpatha is excluded by filter: device is partitioned.
  Cannot use /dev/mapper/mpatha: device is partitioned


# "Remove partitioned device /dev/sdc from devices file."
[root@hayes-02 ~]# pvcreate /dev/sdc1
  Devices file /dev/sdc is excluded by filter: device is partitioned.
  Devices file /dev/mapper/mpatha is excluded by filter: device is partitioned.
  Remove partitioned device /dev/sdc from devices file.
  Physical volume "/dev/sdc1" successfully created.


# There should be a warning here as well then, correct?
[root@hayes-02 ~]# pvcreate /dev/mapper/mpatha1
  Devices file /dev/sdc is excluded by filter: device is partitioned.
  Devices file /dev/mapper/mpatha is excluded by filter: device is partitioned.
  Physical volume "/dev/mapper/mpatha1" successfully created.


[root@hayes-02 ~]# pvscan
  Devices file /dev/sdc is excluded by filter: device is partitioned.
  Devices file /dev/mapper/mpatha is excluded by filter: device is partitioned.
  PV /dev/mapper/mpatha1                      lvm2 [<1.82 TiB]
  PV /dev/sdc1                                lvm2 [<1.82 TiB]
  Total: 2 [<3.64 TiB] / in use: 0 [0   ] / in no VG: 2 [<3.64 TiB]

[root@hayes-02 ~]# cat /etc/lvm/devices/system.devices
# LVM uses devices listed in this file.
# Created by LVM command pvcreate pid 29144 at Tue Feb  8 09:26:51 2022
VERSION=1.1.777
IDTYPE=sys_wwid IDNAME=naa.6d094660650d1e0022bd29ee1e0945a8 DEVNAME=/dev/sdc PVID=.
IDTYPE=mpath_uuid IDNAME=mpath-36d094660650d1e0022bd29e81db0cefc DEVNAME=/dev/mapper/mpatha PVID=.
IDTYPE=sys_wwid IDNAME=naa.6d094660650d1e0022bd29ee1e0945a8 DEVNAME=/dev/sdc1 PVID=If3A6PI9D1IDgKy5vEwlogA1iVeQ9054 PART=1
IDTYPE=mpath_uuid IDNAME=part1-mpath-36d094660650d1e0022bd29e81db0cefc DEVNAME=/dev/mapper/mpatha1 PVID=uXtZS3uhdsm7J7fjmB1GXHqtw5JvJSkq



Version-Release number of selected component (if applicable):
kernel-4.18.0-360.el8    BUILT: Sun Jan 16 20:27:55 CST 2022
lvm2-2.03.14-3.el8    BUILT: Tue Jan  4 14:54:16 CST 2022
lvm2-libs-2.03.14-3.el8    BUILT: Tue Jan  4 14:54:16 CST 2022

Comment 1 David Teigland 2022-02-08 18:28:00 UTC
> At first, I thought these partitioned devices shouldn't even be allowed to
> be added since they're unable to be used by LVM to make PVs.

> [root@hayes-02 ~]# cat /etc/lvm/devices/system.devices
> # LVM uses devices listed in this file.
> # Created by LVM command pvremove pid 29036 at Tue Feb  8 09:22:41 2022
> VERSION=1.1.773
> 
> 
> # This sd device is partitioned
> [root@hayes-02 ~]# lvmdevices --adddev /dev/sdc
>   WARNING: adding device /dev/sdc that is excluded by filter: device is
> partitioned.
> [root@hayes-02 ~]# echo $?
> 0
> 
> # This mpath device is partitioned
> [root@hayes-02 ~]# lvmdevices --adddev /dev/mapper/mpatha
>   WARNING: adding device /dev/mapper/mpatha that is excluded by filter:
> device is partitioned.
> [root@hayes-02 ~]# echo $?
> 0

We don't restrict what's added to the devices file.  A user can add anything they want, and can always do it manually without using a command.  The lvm filtering (in the broadest sense) continues to run in label scan of a full lvm command.  lvmdevices is not a "full" lvm command and is basically just a file editor for system.devices.  It does run some limited filter checks for the sake of warning, but doesn't enforce.  Also, there may be reasons why a user could need some devices file entries that are excluded by filters, e.g. for temporary conditions when changing things.  That said, there could be some cases where we want to refuse adding certain entries to the file, I'm not sure of any off hand, perhaps if we knew the values were wrong.

> Second, the use of  "excluded by filter" in a warning is confusing in a post devicesfile lvm
> era, as we no longer support filters I thought. 

Yeah, this is an unfortunate mistake we made in naming many years ago.  In this context, "filter" refers to the general device filtering lvm does, specifically the partition filter (filter-partition.c), not the regex filter from the lvm.conf "filter" (filter-regex.c).  The devices file is also implemented as a filter (filter-deviceid.c)  The lvm.conf entry should have been named filter_regex.  It would probably be an improvement to drop the words "by filter" in that message, although there are a lot of other messages like that which we'd want to consider at the same time for consistency.

> Third, I originally read
> "Remove partitioned device /dev/sdc from devices file." as LVM was removing
> it for me but then later realized LVM is telling me to do so manually.

All the partition checking/messages in lvmdevices was redone as part of bug 2040482, so we should look at this again when the next build is done.

> So, at a minimum, the mpath pvcreate attempt should also have that warning. 

> [root@hayes-02 ~]# pvcreate /dev/mapper/mpatha
>   Devices file /dev/sdc is excluded by filter: device is partitioned.
>   Devices file /dev/mapper/mpatha is excluded by filter: device is
> partitioned.
>   Cannot use /dev/mapper/mpatha: device is partitioned

> # There should be a warning here as well then, correct?
> [root@hayes-02 ~]# pvcreate /dev/mapper/mpatha1
>   Devices file /dev/sdc is excluded by filter: device is partitioned.
>   Devices file /dev/mapper/mpatha is excluded by filter: device is
> partitioned.
>   Physical volume "/dev/mapper/mpatha1" successfully created.

Those two mpath pvcreates look correct, but I think you're suggesting that one of the other commands didn't look right.

In summary, what I mainly see here are some fine tunings we may want to make to the warnings/messages related to the devices file.  That's also a topic in bug 2050449, and I have some other places in mind for improving the warnings related to stale devices file entries.

Comment 2 David Teigland 2022-04-01 18:44:42 UTC
There are not specific bugs or messages to verify for this bz so I'm just going to close this.  I've made some changes to messages related to the devices file, which I think will avoid some possible confusion.

Comment 3 David Teigland 2022-06-10 16:12:22 UTC
reopening this to use for this commit in main:
https://sourceware.org/git/?p=lvm2.git;a=commit;h=8db3b11e4ed94974bc25c26e2f1271c34f6ccf15

8db3b11e4ed9 change messages about filtered devices

Comment 6 Corey Marthaler 2022-06-17 02:01:25 UTC
I installed the latest 8.7 build and wanted to go over the new behavior. This appears correct and consistent now for both scenarios.

1. There is no mention of filters when adding or pv creating either the partitioned mpath or sd device.
2. The pvcreate does not have a "Remove partitioned device <device> from devices" warning anymore for the sd device.


kernel-4.18.0-400.el8    BUILT: Fri Jun 10 13:11:32 CDT 2022
lvm2-2.03.14-4.el8    BUILT: Wed Jun 15 17:14:34 CDT 2022
lvm2-libs-2.03.14-4.el8    BUILT: Wed Jun 15 17:14:34 CDT 2022



# This sd device is partitioned
[root@hayes-01 ~]# cat /etc/lvm/devices/system.devices 
# LVM uses devices listed in this file.
# Created by LVM command lvmdevices pid 6949 at Thu Jun 16 20:42:19 2022
VERSION=1.1.328
IDTYPE=sys_wwid IDNAME=naa.6d094660575ece002291bb4a313e4759 DEVNAME=/dev/sdf PVID=.
IDTYPE=sys_wwid IDNAME=naa.6d094660575ece002291bb4a313e4759 DEVNAME=/dev/sdf1 PVID=. PART=1

[root@hayes-01 ~]# 
[root@hayes-01 ~]# pvcreate /dev/sdf1
  Devices file /dev/sdf is excluded: device is partitioned.
  WARNING: adding device /dev/sdf1 with idname naa.6d094660575ece002291bb4a313e4759 which is already used for /dev/sdf.
  Physical volume "/dev/sdf1" successfully created.



# This mpath device is partitioned
[root@hayes-01 ~]# cat /etc/lvm/devices/system.devices 
# LVM uses devices listed in this file.
# Created by LVM command lvmdevices pid 7168 at Thu Jun 16 20:46:22 2022
VERSION=1.1.334
IDTYPE=mpath_uuid IDNAME=part1-mpath-36d094660575ece002291bb4a313e4759 DEVNAME=/dev/mapper/mpathb1 PVID=.
IDTYPE=devname IDNAME=/dev/mapper/mpathb1p1 DEVNAME=/dev/mapper/mpathb1p1 PVID=.

[root@hayes-01 ~]# pvcreate /dev/mapper/mpathb1p1
  Devices file /dev/mapper/mpathb1 is excluded: device is partitioned.
  Physical volume "/dev/mapper/mpathb1p1" successfully created.

Comment 8 David Teigland 2022-06-27 19:31:43 UTC
> IDTYPE=mpath_uuid IDNAME=part1-mpath-36d094660575ece002291bb4a313e4759 DEVNAME=/dev/mapper/mpathb1 PVID=.
> IDTYPE=devname IDNAME=/dev/mapper/mpathb1p1 DEVNAME=/dev/mapper/mpathb1p1 PVID=.

> [root@hayes-01 ~]# pvcreate /dev/mapper/mpathb1p1
>   Devices file /dev/mapper/mpathb1 is excluded: device is partitioned.
>   Physical volume "/dev/mapper/mpathb1p1" successfully created.

It's pretty clear that mpathb1 represents a partition on the underlying dev (based on the dm uuid part1-mpath-...), and then apparently a partition table has been written to mpathb1 and kpartx then added mpathb1p1.  I asked Ben, and this kind of partition-on-partition is not something familiar to him either.  So, I'm wondering if this kind of device setup has been used for anything before, or if it's useful in some way?

Comment 10 Corey Marthaler 2022-07-15 17:12:40 UTC
Updating the summary to reflect what was actually changed and what was checked here.

This message is now printed for both partitioned sd devices and partitioned mpath devices:
"Devices file /dev/* is excluded: device is partitioned"


To be clear, the "Remove partitioned device /dev/* from devices file." message no longer exists for either sd or mpath now.

Marking Verified:Tested with the latest rpms.

kernel-4.18.0-398.g366e.el8.kpq1    BUILT: Tue Jun  7 04:56:38 CDT 2022
lvm2-2.03.14-4.el8    BUILT: Wed Jun 15 17:14:34 CDT 2022
lvm2-libs-2.03.14-4.el8    BUILT: Wed Jun 15 17:14:34 CDT 2022

Comment 13 Corey Marthaler 2022-07-27 18:00:45 UTC
Verified with latest kernel/lvm2 as well.

kernel-4.18.0-411.el8    BUILT: Wed Jul 20 18:42:42 CDT 2022
lvm2-2.03.14-5.el8    BUILT: Thu Jul 14 09:23:13 CDT 2022
lvm2-libs-2.03.14-5.el8    BUILT: Thu Jul 14 09:23:13 CDT 2022



SCENARIO - partitioned_mpath_device_PV:  Check for 'excluded: device is partitioned' message when creating a PV from a partitioned mpath device already existing in the devicesfile (bug 2052064) 
Copying out blanked system.devices file to begin with
/tmp/system113.devices -> hayes-01:/etc/lvm/devices/system.devices
WARNING: This scenario will end up repartitioning your device for use w/ mpath!
multipath /dev/sde
create: mpatha (36d094660575ece002291bade2acdbd28) undef DELL,PERC H330 Adp
size=1.8T features='0' hwhandler='0' wp=undef
`-+- policy='service-time 0' prio=1 status=undef
  `- 0:2:4:0  sde 8:64  undef ready running

adding entry to the devices file for /dev/mapper/mpatha1
Using gpt label
Disk size: 1907199 MB
Num partitions: 1
Adding new primary partition: (40, 3905945479) = 1907199 MB
Committing changes
adding entry to the devices file for /dev/mapper/mpatha1p1
  Devices file /dev/mapper/mpatha1 is excluded: device is partitioned.
  Labels on physical volume "/dev/mapper/mpatha1p1" successfully wiped.
removing entry from the devices file for /dev/mapper/mpatha1p1
removing entry from the devices file for /dev/mapper/mpatha1
multipath -f mpatha
multipath -W
successfully reset wwids
Using gpt label
Disk size: 1907199 MB
Num partitions: 1
Adding new primary partition: (40, 3905945559) = 1907199 MB
Committing changes
adding entry to the devices file for /dev/sde1
creating PV on hayes-01 using device /dev/sde1
pvcreate --yes -ff  --zero y /dev/sde1
  Wiping gpt signature on /dev/sde1.
  Wiping gpt signature on /dev/sde1.
  Wiping PMBR signature on /dev/sde1.
  Physical volume "/dev/sde1" successfully created.
removing pv /dev/sde1 on hayes-01
  Labels on physical volume "/dev/sde1" successfully wiped.
removing entry from the devices file for /dev/sde1

Comment 15 errata-xmlrpc 2022-11-08 10:55:24 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-2022:7792