Bug 2027913

Summary: 'pvcreate --test' should not be modifying the devices/system.devices file
Product: Red Hat Enterprise Linux 9 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: David Teigland <teigland>
lvm2 sub component: Devices, Filtering and Stacking QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: high CC: agk, cluster-qe, heinzm, jbrassow, lvm-team, mcsontos, msnitzer, prajnoha, teigland, zkabelac
Version: 9.0Flags: pm-rhel: mirror+
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.03.15-0.1.20211115git4a1f617.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2027906 Environment:
Last Closed: 2022-05-17 15:56:27 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:
Bug Depends On: 2027906    
Bug Blocks:    

Description Corey Marthaler 2021-12-01 03:24:28 UTC
This exists in rhel9.0 as well.

kernel-5.14.0-10.el9    BUILT: Tue Oct 26 07:00:13 PM CDT 2021
lvm2-2.03.14-1.el9    BUILT: Wed Oct 20 11:22:27 AM CDT 2021
lvm2-libs-2.03.14-1.el9    BUILT: Wed Oct 20 11:22:27 AM CDT 2021



+++ This bug was initially created as a clone of Bug #2027906 +++

Description of problem:
# Normal device PV (/dev/sdb1)

[root@hayes-02 ~]# cat /etc/lvm/devices/system.devices
# LVM uses devices listed in this file.
# Created by LVM command pvremove pid 1644466 at Tue Nov 30 20:45:23 2021
VERSION=1.1.4736

[root@hayes-02 ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created.

[root@hayes-02 ~]# cat /etc/lvm/devices/system.devices
# LVM uses devices listed in this file.
# Created by LVM command pvcreate pid 1644509 at Tue Nov 30 20:45:49 2021
VERSION=1.1.4737
IDTYPE=sys_wwid IDNAME=naa.6d094660650d1e0022bd29e81db0cefc DEVNAME=/dev/sdb1 PVID=4Wj0WrIIBKh8h3zQMn8cQHuxx2HFBFkT PART=1

[root@hayes-02 ~]# pvcreate --test /dev/sdb1
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
  Physical volume "/dev/sdb1" successfully created.
[root@hayes-02 ~]# cat /etc/lvm/devices/system.devices
# LVM uses devices listed in this file.
# Created by LVM command fullreport pid 1644515 at Tue Nov 30 20:45:59 2021
VERSION=1.1.4739
IDTYPE=sys_wwid IDNAME=naa.6d094660650d1e0022bd29e81db0cefc DEVNAME=/dev/sdb1 PVID=4Wj0WrIIBKh8h3zQMn8cQHuxx2HFBFkT PART=1



# LV device PV (/dev/VG/LV)

[root@hayes-02 ~]# vgcreate VG /dev/sdb1
  Volume group "VG" successfully created
[root@hayes-02 ~]# lvcreate -n LV -L 10G VG
  Logical volume "LV" created.
[root@hayes-02 ~]# pvcreate --config devices/scan_lvs=1 /dev/VG/LV 
  Physical volume "/dev/VG/LV" successfully created.

[root@hayes-02 ~]# cat /etc/lvm/devices/system.devices
# LVM uses devices listed in this file.
# Created by LVM command pvcreate pid 1644564 at Tue Nov 30 20:48:49 2021
VERSION=1.1.4743
IDTYPE=sys_wwid IDNAME=naa.6d094660650d1e0022bd29e81db0cefc DEVNAME=/dev/sdb1 PVID=4Wj0WrIIBKh8h3zQMn8cQHuxx2HFBFkT PART=1
IDTYPE=lvmlv_uuid IDNAME=LVM-dDU10KcCqvdXk1ojfPActULMZU3m3ED2QbQO41RHwBSfh66Y0BB5O0TiPZR43D1C DEVNAME=/dev/VG/LV PVID=Q4DRDDYcMe0d2Ico5wqC9nF99RFJFp7C

[root@hayes-02 ~]# pvcreate --test --config devices/scan_lvs=1 /dev/VG/LV 
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
  Physical volume "/dev/VG/LV" successfully created.

# PVID was altered
[root@hayes-02 ~]# cat /etc/lvm/devices/system.devices
# LVM uses devices listed in this file.
# Created by LVM command pvcreate pid 1644569 at Tue Nov 30 20:49:10 2021
VERSION=1.1.4744
IDTYPE=sys_wwid IDNAME=naa.6d094660650d1e0022bd29e81db0cefc DEVNAME=/dev/sdb1 PVID=4Wj0WrIIBKh8h3zQMn8cQHuxx2HFBFkT PART=1
IDTYPE=lvmlv_uuid IDNAME=LVM-dDU10KcCqvdXk1ojfPActULMZU3m3ED2QbQO41RHwBSfh66Y0BB5O0TiPZR43D1C DEVNAME=/dev/VG/LV PVID=cOWcuNNc9Ti5HUjCwSb14HUXhHHP4zm2


Version-Release number of selected component (if applicable):
kernel-4.18.0-348.4.el8.kpq0    BUILT: Wed Oct 27 15:00:32 CDT 2021
lvm2-2.03.14-1.el8    BUILT: Wed Oct 20 10:18:17 CDT 2021
lvm2-libs-2.03.14-1.el8    BUILT: Wed Oct 20 10:18:17 CDT 2021


How reproducible:
Everytime

Comment 1 Corey Marthaler 2022-02-17 18:06:04 UTC
Both scenarios pass now in the latest LVM rpms. Marking Verified:Tested.

kernel-5.14.0-58.el9    BUILT: Thu Feb 10 11:18:21 AM CST 2022
lvm2-2.03.14-4.el9    BUILT: Wed Feb 16 06:01:21 AM CST 2022
lvm2-libs-2.03.14-4.el9    BUILT: Wed Feb 16 06:01:21 AM CST 2022
lvm2-dbusd-2.03.14-4.el9    BUILT: Wed Feb 16 07:23:08 AM CST 2022



SCENARIO - pvcreate_test_on_linear_alteration_check:  Test for the alteration of the devicesfiles when pvcreate --test is used on linear device (bug 2027906 2027913) 
adding entry to the devices file for /dev/sdc1
creating PV on hayes-02 using device /dev/sdc1
pvcreate --yes -ff  /dev/sdc1
  Physical volume "/dev/sdc1" successfully created.
creating VG on hayes-02 using PV(s) /dev/sdc1
vgcreate   df /dev/sdc1
  Volume group "df" successfully created
lvcreate --yes --type linear -n dflv -L 500M df  
  Logical volume "dflv" created.
adding entry to the devices file for /dev/df/dflv
creating PV on hayes-02 using device /dev/df/dflv
pvcreate --yes -ff --config devices/scan_lvs=1 /dev/df/dflv
  Physical volume "/dev/df/dflv" successfully created.
pvcreate --test --config devices/scan_lvs=1 /dev/df/dflv
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
  Physical volume "/dev/df/dflv" successfully created.
LVM pre:1tYnl5HZatxNN0PsnaHb2CYqRkH1KbPO post:1tYnl5HZatxNN0PsnaHb2CYqRkH1KbPO
FILE pre:1tYnl5HZatxNN0PsnaHb2CYqRkH1KbPO post:1tYnl5HZatxNN0PsnaHb2CYqRkH1KbPO
removing pv /dev/df/dflv on hayes-02
  Labels on physical volume "/dev/df/dflv" successfully wiped.
removing entry from the devices file for /dev/df/dflv
lvremove  -f df/dflv
  Logical volume "dflv" successfully removed.
removing vg df from hayes-02
  Volume group "df" successfully removed
removing pv /dev/sdc1 on hayes-02
  Labels on physical volume "/dev/sdc1" successfully wiped.
removing entry from the devices file for /dev/sdc1


SCENARIO - pvcreate_test_alteration_check:  Test for the alteration of the devicesfiles when pvcreate --test is used on device (bug 2027906 2027913) 
adding entry to the devices file for /dev/sdc1
creating PV on hayes-02 using device /dev/sdc1
pvcreate --yes -ff  /dev/sdc1
  Physical volume "/dev/sdc1" successfully created.
pvcreate --test /dev/sdc1
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
  Physical volume "/dev/sdc1" successfully created.
LVM pre:OXm3ekIc0dK7eOw7myvGviEOBVICGdnx post:OXm3ekIc0dK7eOw7myvGviEOBVICGdnx
FILE pre:OXm3ekIc0dK7eOw7myvGviEOBVICGdnx post:OXm3ekIc0dK7eOw7myvGviEOBVICGdnx
removing pv /dev/sdc1 on hayes-02
  Labels on physical volume "/dev/sdc1" successfully wiped.
removing entry from the devices file for /dev/sdc1

Comment 4 Corey Marthaler 2022-02-21 21:24:09 UTC
Marking VERIFIED based on comment #1 run on the latest build.

Comment 6 errata-xmlrpc 2022-05-17 15:56:27 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 (new packages: lvm2), 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:3972