Bug 1674563

Summary: Switch the default of "scanning LVs for LVM labels" from 'on' to 'off'
Product: Red Hat Enterprise Linux 7 Reporter: Jonathan Earl Brassow <jbrassow>
Component: lvm2Assignee: David Teigland <teigland>
lvm2 sub component: Devices, Filtering and Stacking QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact: Steven J. Levine <slevine>
Severity: unspecified    
Priority: unspecified CC: agk, bhull, cmarthal, heinzm, jbrassow, loberman, mcsontos, mgandhi, msnitzer, pasik, prajnoha, rbednar, rhandlin, teigland, zkabelac
Version: 7.7-Alt   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.02.184-1.el7 Doc Type: Enhancement
Doc Text:
.New `scan_lvs` configuration setting A new `lvm.conf` configuration file setting, `scan_lvs`, has been added and set to 0 by default. The new default behavior stops LVM from looking for PVs that may exist on top of LVs; that is, it will not scan active LVs for more PVs. The default setting also prevents LVM from creating PVs on top of LVs. Layering PVs on top of LVs can occur by way of VM images placed on top of LVs, in which case it is not safe for the host to access the PVs. Avoiding this unsafe access is the primary reason for the new default behavior. Also, in environments with many active LVs, the amount of device scanning done by LVM can be significantly decreased. The previous behavior can be restored by changing this setting to 1.
Story Points: ---
Clone Of:
: 1676598 (view as bug list) Environment:
Last Closed: 2019-08-06 13:10:44 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:    
Bug Blocks: 1676598    

Description Jonathan Earl Brassow 2019-02-11 16:15:38 UTC
It is a huge support issue that hypervisors are able to see the volume groups created within VMs.

The host machine will create logical volumes that then become the system disk for virtual machines.  Those virtual machines then create volume groups of their own on those disks.  Ideally, the host ignores them; but instead, the opposite is true.  The host scans its own LVs for labels and discovers the volume groups (and associated LVs) created by the VMs.

Support has been reporting problems where tools on the hypervisor are damaging VMs because they are writing to their (private LVs).  This can be avoided if we simply do not scan LVs for labels.

We can do this by switching the default setting in lvm.conf of:
  devices/scan_lvs = 1
to
  devices/scan_lvs = 0

Comment 1 Jonathan Earl Brassow 2019-02-12 15:53:01 UTC
The noticeable, testable effect of this change will be that VGs that are created from a LV (or group of LVs) will no longer be visible or auto-activated.

Comment 9 David Teigland 2019-05-29 18:46:16 UTC
it's fine

Comment 10 Corey Marthaler 2019-05-30 21:53:37 UTC
Verified this is the new default behavior in the latest rpms.

3.10.0-1048.el7.x86_64
lvm2-2.02.185-1.el7    BUILT: Mon May 13 04:36:30 CDT 2019
lvm2-libs-2.02.185-1.el7    BUILT: Mon May 13 04:36:30 CDT 2019
device-mapper-1.02.158-1.el7    BUILT: Mon May 13 04:36:30 CDT 2019
device-mapper-libs-1.02.158-1.el7    BUILT: Mon May 13 04:36:30 CDT 2019
device-mapper-event-1.02.158-1.el7    BUILT: Mon May 13 04:36:30 CDT 2019
device-mapper-event-libs-1.02.158-1.el7    BUILT: Mon May 13 04:36:30 CDT 2019
device-mapper-persistent-data-0.8.1-1.el7    BUILT: Sat May  4 14:53:53 CDT 2019


[root@hayes-02 ~]# grep scan_lvs /etc/lvm/lvm.conf
        # Configuration option devices/scan_lvs.
        scan_lvs = 0



[root@hayes-02 ~]#  pvcreate /dev/sdn1 /dev/sdm1 /dev/sdl1 /dev/sdp1 /dev/sdo1
  Physical volume "/dev/sdn1" successfully created.
  Physical volume "/dev/sdm1" successfully created.
  Physical volume "/dev/sdl1" successfully created.
  Physical volume "/dev/sdp1" successfully created.
  Physical volume "/dev/sdo1" successfully created.
[root@hayes-02 ~]# vgcreate   snapper_thinp /dev/sdn1 /dev/sdm1 /dev/sdl1 /dev/sdp1 /dev/sdo1
  Volume group "snapper_thinp" successfully created
[root@hayes-02 ~]# lvcreate  --thinpool POOL -L 1G --profile thin-performance --zero n --poolmetadatasize 4M snapper_thinp
  Thin pool volume with chunk size 64.00 KiB can address at most 15.81 TiB of data.
  Logical volume "POOL" created.
[root@hayes-02 ~]# lvcreate  -y -k n -s /dev/snapper_thinp/origin -n snap_level1
  Snapshot origin LV origin not found in Volume group snapper_thinp.
[root@hayes-02 ~]# lvcreate  --virtualsize 1G -T snapper_thinp/POOL -n origin
  Logical volume "origin" created.
[root@hayes-02 ~]# lvcreate  -y -k n -s /dev/snapper_thinp/origin -n snap_level1
  WARNING: Sum of all thin volume sizes (2.00 GiB) exceeds the size of thin pool snapper_thinp/POOL (1.00 GiB).
  WARNING: You have not turned on protection against thin pools running out of space.
  WARNING: Set activation/thin_pool_autoextend_threshold below 100 to trigger automatic extension of thin pools before they get full.
  Logical volume "snap_level1" created.
[root@hayes-02 ~]# pvcreate -y /dev/snapper_thinp/snap_level1
  Device /dev/snapper_thinp/snap_level1 excluded by a filter.
[root@hayes-02 ~]# pvcreate --config devices/scan_lvs=1 -y /dev/snapper_thinp/snap_level1
  Physical volume "/dev/snapper_thinp/snap_level1" successfully created.
[root@hayes-02 ~]# vgcreate  -f snapper_thinp_stack /dev/snapper_thinp/snap_level1
  WARNING: Device for PV 2tQDTL-1dqN-OosC-GAda-xnw1-lW8h-P11QVa not found or rejected by a filter.
  WARNING: Device for PV 2tQDTL-1dqN-OosC-GAda-xnw1-lW8h-P11QVa not found or rejected by a filter.
  Device /dev/snapper_thinp/snap_level1 excluded by a filter.
[root@hayes-02 ~]# vgcreate --config devices/scan_lvs=1  -f snapper_thinp_stack /dev/snapper_thinp/snap_level1
  Volume group "snapper_thinp_stack" successfully created
[root@hayes-02 ~]# lvcreate -L 100M snapper_thinp_stack -n origin
  WARNING: Device for PV 2tQDTL-1dqN-OosC-GAda-xnw1-lW8h-P11QVa not found or rejected by a filter.
  Couldn't find device with uuid 2tQDTL-1dqN-OosC-GAda-xnw1-lW8h-P11QVa.
  Cannot change VG snapper_thinp_stack while PVs are missing.
  Consider vgreduce --removemissing.
  Cannot process volume group snapper_thinp_stack
[root@hayes-02 ~]# lvcreate --config devices/scan_lvs=1  -L 100M snapper_thinp_stack -n origin
  Logical volume "origin" created.
[root@hayes-02 ~]# lvs
  WARNING: Device for PV 2tQDTL-1dqN-OosC-GAda-xnw1-lW8h-P11QVa not found or rejected by a filter.
  WARNING: Device for PV 2tQDTL-1dqN-OosC-GAda-xnw1-lW8h-P11QVa not found or rejected by a filter.
  Couldn't find device with uuid 2tQDTL-1dqN-OosC-GAda-xnw1-lW8h-P11QVa.
  WARNING: Couldn't find all devices for LV snapper_thinp_stack/origin while checking used and assumed devices.
  LV          VG                  Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  POOL        snapper_thinp       twi-aot---   1.00g             0.02   11.13                           
  origin      snapper_thinp       Vwi-a-t---   1.00g POOL        0.00                                   
  snap_level1 snapper_thinp       Vwi-aot---   1.00g POOL origin 0.02                                   
  origin      snapper_thinp_stack -wi-a---p- 100.00m                                                    
[root@hayes-02 ~]# lvs --config devices/scan_lvs=1
  LV          VG                  Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  POOL        snapper_thinp       twi-aot---   1.00g             0.02   11.13                           
  origin      snapper_thinp       Vwi-a-t---   1.00g POOL        0.00                                   
  snap_level1 snapper_thinp       Vwi-aot---   1.00g POOL origin 0.02                                   
  origin      snapper_thinp_stack -wi-a----- 100.00m                                                    
[root@hayes-02 ~]# pvs
  WARNING: Device for PV 2tQDTL-1dqN-OosC-GAda-xnw1-lW8h-P11QVa not found or rejected by a filter.
  WARNING: Device for PV 2tQDTL-1dqN-OosC-GAda-xnw1-lW8h-P11QVa not found or rejected by a filter.
  WARNING: Device for PV 2tQDTL-1dqN-OosC-GAda-xnw1-lW8h-P11QVa not found or rejected by a filter.
  Couldn't find device with uuid 2tQDTL-1dqN-OosC-GAda-xnw1-lW8h-P11QVa.
  WARNING: Couldn't find all devices for LV snapper_thinp_stack/origin while checking used and assumed devices.
  PV         VG                  Fmt  Attr PSize    PFree   
  /dev/sdl1  snapper_thinp       lvm2 a--   446.62g  446.62g
  /dev/sdm1  snapper_thinp       lvm2 a--   446.62g  446.62g
  /dev/sdn1  snapper_thinp       lvm2 a--   446.62g <445.62g
  /dev/sdo1  snapper_thinp       lvm2 a--   446.62g <446.62g
  /dev/sdp1  snapper_thinp       lvm2 a--   446.62g  446.62g
  [unknown]  snapper_thinp_stack lvm2 a-m  1020.00m  920.00m
[root@hayes-02 ~]# pvs --config devices/scan_lvs=1
  PV                             VG                  Fmt  Attr PSize    PFree   
  /dev/sdl1                      snapper_thinp       lvm2 a--   446.62g  446.62g
  /dev/sdm1                      snapper_thinp       lvm2 a--   446.62g  446.62g
  /dev/sdn1                      snapper_thinp       lvm2 a--   446.62g <445.62g
  /dev/sdo1                      snapper_thinp       lvm2 a--   446.62g <446.62g
  /dev/sdp1                      snapper_thinp       lvm2 a--   446.62g  446.62g
  /dev/snapper_thinp/snap_level1 snapper_thinp_stack lvm2 a--  1020.00m  920.00m

Comment 12 errata-xmlrpc 2019-08-06 13:10:44 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, 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-2019:2253