oVirt / vdsm

The Virtual Desktop Server Manager
GNU General Public License v2.0
160 stars 201 forks source link

lvmdevices: always create devices file #324

Closed aesteve-rh closed 1 year ago

aesteve-rh commented 1 year ago

Create empty devices file even if no lvm volumes are found with vdsm-tool config-lvm-filter.

Otherwise configuring LVM to use a devices file without the file allows lvm commands to see all volumes, with the associated risk.

Bug-Url: https://bugzilla.redhat.com/2125290 Signed-off-by: Albert Esteve aesteve@redhat.com

aesteve-rh commented 1 year ago

Installed on a host without lvm mounts and no devices file (lvmdevices.is_configured() returns False):

 $ lvs                                                                                                                                                                                                                                                                                                           
  LV                                   VG                                   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert                                                                                                                                                                            
  12388749-b0fe-4cfb-bfa8-4ab10a24c24f 38f0f4d4-3ae1-4314-bc6d-d1939c50637c -wi-------  <4.38g                                                                                                                                                                                                                                
  1eae686c-81ec-44cb-88cf-ffed47c649d3 38f0f4d4-3ae1-4314-bc6d-d1939c50637c -wi------- 128.00m                                                                                                                                                                                                                                
  39a866f9-cf0f-4326-aabb-4ff0416090a2 38f0f4d4-3ae1-4314-bc6d-d1939c50637c -wi-------   2.50g                                                                                                                                                                                                                                
  3f345d1e-789a-4494-97f0-a2138d570386 38f0f4d4-3ae1-4314-bc6d-d1939c50637c -wi-------   1.62g                                                                                                                                                                                                                                
  b806a1d4-8e56-4796-beda-b09f8a8231f0 38f0f4d4-3ae1-4314-bc6d-d1939c50637c -wi-------   4.12g                                                                                                                                                                                                                                
  c82d5439-c21a-4a41-80d4-59615639a99f 38f0f4d4-3ae1-4314-bc6d-d1939c50637c -wi-------   2.50g                                                                                                                                                                                                                                
  e54ab135-fc33-4718-a053-864b9ab24410 38f0f4d4-3ae1-4314-bc6d-d1939c50637c -wi------- 128.00m                                                                                                                                                                                                                                
  ids                                  38f0f4d4-3ae1-4314-bc6d-d1939c50637c -wi------- 128.00m                                                                                                                                                                                                                                
  inbox                                38f0f4d4-3ae1-4314-bc6d-d1939c50637c -wi------- 128.00m                                                                                                                                                                                                                                
  leases                               38f0f4d4-3ae1-4314-bc6d-d1939c50637c -wi-------   2.00g
...

If we run vdsm-tool config-lvm-filter, an empty devices file is created:

$ vdsm-tool config-lvm-filter
Analyzing host...
Found these mounted logical volumes on this host:

To properly configure the host, we need to add multipath
blacklist in /etc/multipath/conf.d/vdsm_blacklist.conf:

  blacklist {
      wwid "0QEMU_QEMU_HARDDISK_data-fc3"
  }

Configure host? [yes,NO] yes
Configuration completed successfully!

Please reboot to verify the configuration.

$ cat /etc/lvm/devices/system.devices
$ ll /etc/lvm/devices/system.devices
-rw-r--r--. 1 root root 0 Sep 27 13:33 /etc/lvm/devices/system.devices

And lvm command does not see any volume:

$ lvs
$
aesteve-rh commented 1 year ago

Verified with latest version (that adds a comment to the devicesfile):

$ cat /etc/lvm/devices/system.devices
# Created by Vdsm pid 7237 at Fri Sep 30 12:00:47 2022

Original LVM header (for reference):

$ cat /etc/lvm/devices/system.devices
# LVM uses devices listed in this file.
# Created by LVM command vgimportdevices pid 48030 at Wed Apr  6 18:20:03 2022
aesteve-rh commented 1 year ago

/ost

aesteve-rh commented 1 year ago

/ost