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 1954247

Summary: New udev rule and systemd unit for VG autoactivation
Product: Red Hat Enterprise Linux 9 Reporter: David Teigland <teigland>
Component: lvm2Assignee: David Teigland <teigland>
lvm2 sub component: Activating existing Logical Volumes QA Contact: cluster-qe <cluster-qe>
Status: CLOSED CURRENTRELEASE Docs Contact:
Severity: unspecified    
Priority: urgent CC: agk, cmarthal, heinzm, jbrassow, lmiksik, mcsontos, msnitzer, prajnoha, zkabelac
Version: 9.0Keywords: Triaged
Target Milestone: betaFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.03.13-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-07 21:42:00 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:
Attachments:
Description Flags
test results
none
test results none

Description David Teigland 2021-04-27 19:08:06 UTC
Description of problem:

Autoactivation of VGs during systemd startup is being updated with a new udev rule and systemd unit, for a cleaner separation of device identification from actual activation.  This allows a traditional vgchange command to be used for activation instead of activation being performed as a side effect of pvscan-based device identification.  This also moves closer to the kind of scanning/activation that will be used by SID.

New udev rule runs pvscan directly, which reads only the device that triggered the uevent, and reports if a VG is complete and ready for activation.
The udev rule runs a new systemd service lvm-vgchange@<vgname> if the pvscan reported a complete VG.

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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 David Teigland 2021-05-13 15:12:24 UTC
Currently in dev-next branch

Comment 2 David Teigland 2021-05-26 17:18:48 UTC
The mechanism has changed a bit since the original description.  The udev rule now uses systemd-run vgchange -aay instead of systemctl start lvm-vchange@ (where this service runs vchange -aay).

For testing, the main things I can think of that are related to this:

- various kinds of devices that people put PVs on, physical and virtual (md, mpath, crypt).

- the number of PVs that need to be attached before the VG can be autoactivated (1 to many, e.g. 1000).

- PVs being attached concurrently (so the pvscans are running at the same time) vs sequentially over time.

- the number of PVs that hold metadata (1 to all).

- the autoactivated VG containing a number of LVs that require monitoring, which means the vgchange needs to interact with dmeventd.

- the autoactivated VG containing LVs that need to continue polling upon being activated (e.g. a snapshot merge) which means vgchange needs to interact with lvmpolld.

- that event_activation=0 in lvm.conf prevents the VG from being autoactivated when the devices are attached on a running system (the VG would still be autoactivated by lvm2-activation-* services during system startup.)

Comment 3 David Teigland 2021-05-26 17:51:48 UTC
There are three ways to trigger the device attachment uevents which exercise these features:

1. actually reboot the machine

2. echo 1 > /sys/block/<devname>/device/delete; echo "- - -" > /sys/class/scsi_host/<host>/scan

3. udevadm trigger -c add /sys/block/<dev>


1 is the most realistic, but is most time consuming and hard to control.  It might reveal some issues that wouldn't be seen otherwise related to interactions with other system startup steps.

2 is a pretty realistic, and I'm not sure what downsides it might have.

3 is probably the quickest and simple to do from a test script (this is what I use in udev-pvscan-vgchange.sh).

Comment 5 David Teigland 2021-07-15 20:00:57 UTC
bug 1954256 involves making similar changes in dracut

Comment 7 David Teigland 2021-07-26 15:54:30 UTC
It doesn't matter to me, it might be better to ask Corey.  There might be some problems applying dev-next commits onto 2.03.12 since that will be about 3 months old.

Comment 13 David Teigland 2021-08-24 15:31:52 UTC
Created attachment 1817175 [details]
test results

Results of
make check_local LVM_TEST_DEVICE_LIST=/tmp/devs T=shell/udev-pvscan-vgchange.sh

Comment 14 David Teigland 2021-08-24 15:39:30 UTC
Created attachment 1817176 [details]
test results

Results of
make check_devicesfile LVM_TEST_DEVICE_LIST=/tmp/devs T=shell/udev-pvscan-vgchange.sh

Comment 15 David Teigland 2021-08-24 15:44:54 UTC
Setting verified:tested based on Corey's request in comment 4 and test results in comments 13 and 14.

Comment 20 Corey Marthaler 2021-10-04 14:18:25 UTC
Marking Verified in the latest rpms.

kernel-5.14.0-1.2.1.el9    BUILT: Fri Sep 17 02:57:25 AM CDT 2021
lvm2-2.03.13-2.el9_b    BUILT: Fri Sep 17 10:55:56 AM CDT 2021
lvm2-libs-2.03.13-2.el9_b    BUILT: Fri Sep 17 10:55:56 AM CDT 2021


I create many of the stacks mentioned in comment #2, md raid, crypt, PVs on lvm linear, snapshots, snapshots with merges pending, partial raids and partial mirrors, and all of them (with the exception of dm-mirrors) were auto mounted on reboot.

[root@hayes-02 bin]# lvs -a -o +devices,autoactivation
  WARNING: Couldn't find device with uuid 7d6xza-gHUI-QZpc-JnpR-I4PH-bTUN-C3Ru5t.
  WARNING: VG mirror_vg is missing PV 7d6xza-gHUI-QZpc-JnpR-I4PH-bTUN-C3Ru5t (last written to /dev/sdh1).
  WARNING: Couldn't find all devices for LV mirror_vg/auto_mirror_mimage_1 while checking used and assumed devices.
  WARNING: Couldn't find all devices for LV mirror_vg/auto_mirror_mlog while checking used and assumed devices.
  LV                     VG            Attr       LSize   Origin Data%  Meta%  Move Log                Cpy%Sync Devices                                         AutoAct
  linear                 base_stack_vg -wi-ao---- 600.00m                                                       /dev/sdf1(0)                                    enabled
  linear                 crypt_vg      Owi---s--- 600.00m                                                       /dev/mapper/auto(0)                             enabled
  [snap2]                crypt_vg      Swi---s---   8.00m linear                                                /dev/mapper/auto(150)                           enabled
  linear                 default_vg    owi-a-s--- 600.00m                                                       /dev/sde1(0)                                    enabled
  snap3                  default_vg    swi-a-s---   8.00m linear 0.00                                           /dev/sde1(150)                                  enabled
  linear                 md_vg         owi-a-s--- 600.00m                                                       /dev/md127(0)                                   enabled
  snap1                  md_vg         swi-a-s---   8.00m linear 0.00                                           /dev/md127(150)                                 enabled
  auto_mirror            mirror_vg     mwi-a-m-p- 100.00m                           [auto_mirror_mlog] 100.00   auto_mirror_mimage_0(0),auto_mirror_mimage_1(0) enabled
  [auto_mirror_mimage_0] mirror_vg     iwi-aom--- 100.00m                                                       /dev/sdg1(0)                                    enabled
  [auto_mirror_mimage_1] mirror_vg     iwi-aom-p- 100.00m                                                       [unknown](0)                                    enabled
  [auto_mirror_mlog]     mirror_vg     lwi-aom-p-   4.00m                                                       [unknown](25)                                   enabled


# REBOOT


[root@hayes-02 ~]# lvs -a -o +devices,autoactivation
  WARNING: Couldn't find device with uuid 7d6xza-gHUI-QZpc-JnpR-I4PH-bTUN-C3Ru5t.
  WARNING: VG mirror_vg is missing PV 7d6xza-gHUI-QZpc-JnpR-I4PH-bTUN-C3Ru5t (last written to /dev/sdh1).
  LV                     VG            Attr       LSize   Pool Origin Data%  Meta%  Move Log                Cpy%Sync Convert Devices                                         AutoAct
  linear                 base_stack_vg -wi-a----- 600.00m                                                                    /dev/sdf1(0)                                    enabled
  linear                 crypt_vg      -wi-a----- 600.00m                                                                    /dev/mapper/auto(0)                             enabled
  linear                 default_vg    owi-a-s--- 600.00m                                                                    /dev/sde1(0)                                    enabled
  snap3                  default_vg    swi-a-s---   8.00m      linear 0.00                                                   /dev/sde1(150)                                  enabled
  linear                 md_vg         owi-a-s--- 600.00m                                                                    /dev/md127(0)                                   enabled
  snap1                  md_vg         swi-a-s---   8.00m      linear 0.00                                                   /dev/md127(150)                                 enabled
  auto_mirror            mirror_vg     mwi---m-p- 100.00m                                [auto_mirror_mlog]                  auto_mirror_mimage_0(0),auto_mirror_mimage_1(0) enabled
  [auto_mirror_mimage_0] mirror_vg     Iwi---m--- 100.00m                                                                    /dev/sdg1(0)                                    enabled
  [auto_mirror_mimage_1] mirror_vg     Iwi---m-p- 100.00m                                                                    [unknown](0)                                    enabled
  [auto_mirror_mlog]     mirror_vg     lwi---m-p-   4.00m                                                                    [unknown](25)                                   enabled