Bug 2095501

Summary: lvmdevices: make deldev work for missing device
Product: Red Hat Enterprise Linux 8 Reporter: David Teigland <teigland>
Component: lvm2Assignee: David Teigland <teigland>
lvm2 sub component: Devices, Filtering and Stacking QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: agk, cmarthal, heinzm, jbrassow, mcsontos, msnitzer, prajnoha, zkabelac
Version: 8.0Keywords: Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
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:29 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 David Teigland 2022-06-09 19:16:38 UTC
Description of problem:

lvmdevices --deldev would not work when the name device was missing.

This seems to have been fixed as part of rhel9 bug 2040482, but that bug is a confusing combination of issues and fixes, so creating a new bug to backport this specific fix to rhel8.

fix in main branch:
https://sourceware.org/git/?p=lvm2.git;a=commit;h=3fce6a81f82f2b2b1f75e5d49dbffc77bd637b3c

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 3 Corey Marthaler 2022-07-06 19:27:45 UTC
Marking Verified:Tested in the latest rpms.

# 8.6 PRE FIX 
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


SCENARIO - entry_deletion_w_missing_mpath_device:  Test stale devicesfile entry deletion using missing mpath devices (bug 2040482#c2)
WARNING: This scenario will end up repartitioning your device for use w/ mpath!
multipath /dev/sdf
create: mpatha (36d094660650d1e0022bd2a001f1ae16e) undef DELL,PERC H330 Adp
size=1.8T features='0' hwhandler='0' wp=undef
`-+- policy='service-time 0' prio=1 status=undef
  `- 0:2:5:0  sdf 8:80  undef ready running

adding entry to the devices file for /dev/mapper/mpatha1
creating PV on hayes-02 using device /dev/mapper/mpatha1
pvcreate --yes -ff   /dev/mapper/mpatha1
  Physical volume "/dev/mapper/mpatha1" successfully created.
  WARNING: D-Bus notification failed: Connection timed out
Device part1-mpath-36d094660650d1e0022bd2a001f1ae16e has idtype mpath_uuid
0. Verify the given idtype was used by the default lvm devices entry creation for part1-mpath-36d094660650d1e0022bd2a001f1ae16e
Device part1-mpath-36d094660650d1e0022bd2a001f1ae16e has idtype mpath_uuid
1a. Check for valid devicesfile entry for newly created DcrQWNEASqkD0du6mc3d2zsck96dYCWn
IDTYPE=mpath_uuid IDNAME=part1-mpath-36d094660650d1e0022bd2a001f1ae16e DEVNAME=/dev/mapper/mpatha1 PVID=DcrQWNEASqkD0du6mc3d2zsck96dYCWn
1b. Remove device file entry based on PV name /dev/mapper/mpatha1
removing entry from the devices file for /dev/mapper/mpatha1
2a. Add device file entry based on PVID DcrQWNEASqkD0du6mc3d2zsck96dYCWn
  Found PVID DcrQWNEASqkD0du6mc3d2zsck96dYCWn on /dev/mapper/mpatha1.
IDTYPE=mpath_uuid IDNAME=part1-mpath-36d094660650d1e0022bd2a001f1ae16e DEVNAME=/dev/mapper/mpatha1 PVID=DcrQWNEASqkD0du6mc3d2zsck96dYCWn
2b. Remove device file entry based on PVID DcrQWNEASqkD0du6mc3d2zsck96dYCWn
3. Add device file entry based on PV name
adding entry to the devices file for /dev/mapper/mpatha1
IDTYPE=mpath_uuid IDNAME=part1-mpath-36d094660650d1e0022bd2a001f1ae16e DEVNAME=/dev/mapper/mpatha1 PVID=DcrQWNEASqkD0du6mc3d2zsck96dYCWn
removing pv /dev/mapper/mpatha1 on hayes-02
  Labels on physical volume "/dev/mapper/mpatha1" successfully wiped.
removing entry from the devices file for /dev/mapper/mpatha1

adding entry to the devices file for /dev/mapper/mpatha1
creating PV on hayes-02 using device /dev/mapper/mpatha1
pvcreate --yes -ff   /dev/mapper/mpatha1
  Physical volume "/dev/mapper/mpatha1" successfully created.
Remove the backing mpath device and attempt to remove and re-add the device file entry 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
lvmdevices --deldev /dev/mapper/mpatha1
  Devices file mpath_uuid part1-mpath-36d094660650d1e0022bd2a001f1ae16e PVID BJjoh1da6LdfcoXzSG8lI8ZJJO7f24WC last seen on /dev/mapper/mpatha1 not found.
  No device found for /dev/mapper/mpatha1.
lvmdevices should have completed the deletion of a missing device's entry


SCENARIO - entry_deletion_w_missing_loopback_device:  Test stale devicesfile entry deletion using missing loopback devices (bug 2040482#c2)
50+0 records in
50+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.0243398 s, 2.2 GB/s
adding entry to the devices file for /dev/loop0
creating PV on hayes-02 using device /dev/loop0
pvcreate --yes -ff   /dev/loop0
  Physical volume "/dev/loop0" successfully created.
Remove the backing loop device and attempt to remove and re-add the device file entry for /dev/loop0
lvmdevices --deldev /dev/loop0
  Devices file loop_file /tmp/loopback.3420990.8819 PVID 2Gb1k6jX98ui0g5peaeHIHyw7SYqhIiB last seen on /dev/loop0 not found.
  Device not found in devices file.
lvmdevices should have completed the deletion of a missing device's entry




# 8.7 POST FIX
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


SCENARIO - entry_deletion_w_missing_mpath_device:  Test stale devicesfile entry deletion using missing mpath devices (bug 2040482#c2)
WARNING: This scenario will end up repartitioning your device for use w/ mpath!
multipath /dev/sdf
create: mpatha (36d094660575ece002291bb4a313e4759) undef DELL,PERC H330 Adp
size=1.8T features='0' hwhandler='0' wp=undef
`-+- policy='service-time 0' prio=1 status=undef
  `- 0:2:5:0  sdf 8:80  undef ready running

adding entry to the devices file for /dev/mapper/mpatha1
creating PV on hayes-01 using device /dev/mapper/mpatha1
pvcreate --yes -ff   /dev/mapper/mpatha1
  Physical volume "/dev/mapper/mpatha1" successfully created.
Device part1-mpath-36d094660575ece002291bb4a313e4759 has idtype mpath_uuid
0. Verify the given idtype was used by the default lvm devices entry creation for part1-mpath-36d094660575ece002291bb4a313e4759
Device part1-mpath-36d094660575ece002291bb4a313e4759 has idtype mpath_uuid
1a. Check for valid devicesfile entry for newly created 6RBnZVzQmB5IaUbPf8wTxR2351RLqHAe
IDTYPE=mpath_uuid IDNAME=part1-mpath-36d094660575ece002291bb4a313e4759 DEVNAME=/dev/mapper/mpatha1 PVID=6RBnZVzQmB5IaUbPf8wTxR2351RLqHAe
1b. Remove device file entry based on PV name /dev/mapper/mpatha1
removing entry from the devices file for /dev/mapper/mpatha1
2a. Add device file entry based on PVID 6RBnZVzQmB5IaUbPf8wTxR2351RLqHAe
  Found PVID 6RBnZVzQmB5IaUbPf8wTxR2351RLqHAe on /dev/mapper/mpatha1.
IDTYPE=mpath_uuid IDNAME=part1-mpath-36d094660575ece002291bb4a313e4759 DEVNAME=/dev/mapper/mpatha1 PVID=6RBnZVzQmB5IaUbPf8wTxR2351RLqHAe
2b. Remove device file entry based on PVID 6RBnZVzQmB5IaUbPf8wTxR2351RLqHAe
3. Add device file entry based on PV name
adding entry to the devices file for /dev/mapper/mpatha1
IDTYPE=mpath_uuid IDNAME=part1-mpath-36d094660575ece002291bb4a313e4759 DEVNAME=/dev/mapper/mpatha1 PVID=6RBnZVzQmB5IaUbPf8wTxR2351RLqHAe
removing pv /dev/mapper/mpatha1 on hayes-01
  Labels on physical volume "/dev/mapper/mpatha1" successfully wiped.
removing entry from the devices file for /dev/mapper/mpatha1

adding entry to the devices file for /dev/mapper/mpatha1
creating PV on hayes-01 using device /dev/mapper/mpatha1
pvcreate --yes -ff   /dev/mapper/mpatha1
  Physical volume "/dev/mapper/mpatha1" successfully created.
Remove the backing mpath device and attempt to remove and re-add the device file entry 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
lvmdevices --deldev /dev/mapper/mpatha1
  Devices file mpath_uuid part1-mpath-36d094660575ece002291bb4a313e4759 PVID f69tk0basvmVjP17aq7sT5w6jg2YA5rn last seen on /dev/mapper/mpatha1 not found.


SCENARIO - entry_deletion_w_missing_loopback_device:  Test stale devicesfile entry deletion using missing loopback devices (bug 2040482#c2)
50+0 records in
50+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.0252474 s, 2.1 GB/s
adding entry to the devices file for /dev/loop0
creating PV on hayes-01 using device /dev/loop0
pvcreate --yes -ff   /dev/loop0
  Physical volume "/dev/loop0" successfully created.
Remove the backing loop device and attempt to remove and re-add the device file entry for /dev/loop0
lvmdevices --deldev /dev/loop0
  Devices file loop_file /tmp/loopback.3419829.5486 PVID T8VSSb9np8EgO3gp4mykpfSNCWRfZeYg last seen on /dev/loop0 not found.

Comment 7 Corey Marthaler 2022-07-28 16:04:56 UTC
Fix verified with the latest kernel/lvm2 rpms 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 - entry_deletion_w_missing_mpath_device:  Test stale devicesfile entry deletion using missing mpath devices (bug 2040482#c2)
WARNING: This scenario will end up repartitioning your device for use w/ mpath!
multipath /dev/sdm
create: mpathb (36d094660650d1e0022bd2a2c21ba1de2) undef DELL,PERC H330 Adp
size=447G features='0' hwhandler='0' wp=undef
`-+- policy='service-time 0' prio=1 status=undef
  `- 0:2:12:0 sdm 8:192 undef ready running

adding entry to the devices file for /dev/mapper/mpathb1
creating PV on hayes-02 using device /dev/mapper/mpathb1
pvcreate --yes -ff   /dev/mapper/mpathb1
  Physical volume "/dev/mapper/mpathb1" successfully created.
Device part1-mpath-36d094660650d1e0022bd2a2c21ba1de2 has idtype mpath_uuid
0. Verify the given idtype was used by the default lvm devices entry creation for part1-mpath-36d094660650d1e0022bd2a2c21ba1de2
Device part1-mpath-36d094660650d1e0022bd2a2c21ba1de2 has idtype mpath_uuid
1a. Check for valid devicesfile entry for newly created 4nk8eOhdU0966DnVJ88Rxchrd3IgblJw
IDTYPE=mpath_uuid IDNAME=part1-mpath-36d094660650d1e0022bd2a2c21ba1de2 DEVNAME=/dev/mapper/mpathb1 PVID=4nk8eOhdU0966DnVJ88Rxchrd3IgblJw
1b. Remove device file entry based on PV name /dev/mapper/mpathb1
removing entry from the devices file for /dev/mapper/mpathb1
2a. Add device file entry based on PVID 4nk8eOhdU0966DnVJ88Rxchrd3IgblJw
  Found PVID 4nk8eOhdU0966DnVJ88Rxchrd3IgblJw on /dev/mapper/mpathb1.
IDTYPE=mpath_uuid IDNAME=part1-mpath-36d094660650d1e0022bd2a2c21ba1de2 DEVNAME=/dev/mapper/mpathb1 PVID=4nk8eOhdU0966DnVJ88Rxchrd3IgblJw
2b. Remove device file entry based on PVID 4nk8eOhdU0966DnVJ88Rxchrd3IgblJw
3. Add device file entry based on PV name
adding entry to the devices file for /dev/mapper/mpathb1
IDTYPE=mpath_uuid IDNAME=part1-mpath-36d094660650d1e0022bd2a2c21ba1de2 DEVNAME=/dev/mapper/mpathb1 PVID=4nk8eOhdU0966DnVJ88Rxchrd3IgblJw
removing pv /dev/mapper/mpathb1 on hayes-02
  Labels on physical volume "/dev/mapper/mpathb1" successfully wiped.
removing entry from the devices file for /dev/mapper/mpathb1

adding entry to the devices file for /dev/mapper/mpathb1
creating PV on hayes-02 using device /dev/mapper/mpathb1
pvcreate --yes -ff   /dev/mapper/mpathb1
  Physical volume "/dev/mapper/mpathb1" successfully created.
Remove the backing mpath device and attempt to remove and re-add the device file entry for /dev/mapper/mpathb1
multipath -f mpathb
multipath -W
successfully reset wwids
Using gpt label
Disk size: 457343 MB
Num partitions: 1
Adding new primary partition: (40, 936640471) = 457343 MB
Committing changes
lvmdevices --deldev /dev/mapper/mpathb1
  Devices file mpath_uuid part1-mpath-36d094660650d1e0022bd2a2c21ba1de2 PVID tWSBO6fCocZxl7qyLUH73YTTOhfoX54V last seen on /dev/mapper/mpathb1 not found.


SCENARIO - entry_deletion_w_missing_loopback_device:  Test stale devicesfile entry deletion using missing loopback devices (bug 2040482#c2)
50+0 records in
50+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.0251818 s, 2.1 GB/s
adding entry to the devices file for /dev/loop0
creating PV on hayes-02 using device /dev/loop0
pvcreate --yes -ff   /dev/loop0
  Physical volume "/dev/loop0" successfully created.
Remove the backing loop device and attempt to remove and re-add the device file entry for /dev/loop0
lvmdevices --deldev /dev/loop0
  Devices file loop_file /tmp/loopback.518739.4483 PVID jguLCfoRHo1eB713wdCJSiylDFsfN61d last seen on /dev/loop0 not found.

Comment 9 errata-xmlrpc 2022-11-08 10:55:29 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