Bug 2222949

Summary: RFE - Request to remove missing devices with lvmdevices command
Product: Red Hat Enterprise Linux 9 Reporter: John Pittman <jpittman>
Component: lvm2Assignee: David Teigland <teigland>
lvm2 sub component: Devices, Filtering and Stacking QA Contact: cluster-qe <cluster-qe>
Status: POST --- Docs Contact:
Severity: low    
Priority: low CC: agk, cmarthal, heinzm, jbrassow, mgandhi, msnitzer, prajnoha, teigland, vvelanka, zkabelac
Version: 9.2Keywords: FutureFeature, Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Story
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Pittman 2023-07-14 14:51:35 UTC
Description of problem:

RFE - Request to add --removemissing to lvmdevices command.  For example if a user removes 50 backend luns that are PVs, the --removemissing command could remove all entries from the devices file in one command.

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

lvm2-2.03.17-7.el9
lvm2-libs-2.03.17-7.el9

Comment 3 David Teigland 2023-07-24 20:18:42 UTC
The new command is:  lvmdevices --update --delnotfound.


# cat /etc/lvm/devices/system.devices 
# LVM uses devices listed in this file.
# Created by LVM command vgimportdevices pid 1186715 at Mon Jul 24 15:16:15 2023
SYSTEMID=foo
VERSION=1.1.2
IDTYPE=sys_wwid IDNAME=naa.50014ee058bfe7b3 DEVNAME=/dev/sda2 PVID=qaWEiaFIIGJwyAgTWucDK00wVFg0s3dj PART=2

# echo "IDTYPE=sys_wwid IDNAME=naa.123 DEVNAME=/dev/sdx1 PVID=aaa PART=1" >> /etc/lvm/devices/system.devices 
# echo "IDTYPE=devname IDNAME=/dev/sdy DEVNAME=/dev/sdy PVID=bbb" >> /etc/lvm/devices/system.devices 

# pvs
  Devices file sys_wwid naa.123 PVID aaa last seen on /dev/sdx1 not found.
  Devices file PVID bbb last seen on /dev/sdy not found.
  PV         VG           Fmt  Attr PSize    PFree
  /dev/sda2  rhel_null-04 lvm2 a--  <464.76g    0 

# lvmdevices --update --delnotfound
  Devices file sys_wwid naa.123 PVID aaa last seen on /dev/sdx1 not found.
  Devices file PVID bbb last seen on /dev/sdy not found.
  Not searching for missing devnames, search_for_devnames="none".
  Deleting IDTYPE=sys_wwid IDNAME=naa.123 PVID=aaa
  Deleting IDTYPE=devname IDNAME=/dev/sdy PVID=bbb
  Updated devices file to version 1.1.3

# cat /etc/lvm/devices/system.devices 
# LVM uses devices listed in this file.
# Created by LVM command lvmdevices pid 1186745 at Mon Jul 24 15:17:11 2023
SYSTEMID=foo
VERSION=1.1.3
IDTYPE=sys_wwid IDNAME=naa.50014ee058bfe7b3 DEVNAME=/dev/sda2 PVID=qaWEiaFIIGJwyAgTWucDK00wVFg0s3dj PART=2