How to configure LVM filters in RHV 4.1 and higher?
Environment
- Red Hat Virtualization 4.1, 4.2, 4.3, 4.4
Issue
- How to configure LVM filters in RHV environment ?
- How to use vdsm-tool for configuring lvm filters on hosts automatically on Red Hat Virtualization Hosts?
Resolution
Since RHV-4.1.9 (vdsm-4.19.44), a tool to configure the lvm filter on hosts automatically is available, as its automatic its less prone to errors compared to making changes manually in the /etc/lvm/lvm.conf.
Summary Steps:
For every host in the Data-Center:
1. Switch host to Maintenance Mode
2. SSH to host
3. If the boot device is a local disk, blacklist it in multipath [*]
4. Run the vdsm-tool config-lvm-filter tool
5. Reboot host
6. Activate host
Below is the example to use the tool:
# /usr/bin/vdsm-tool config-lvm-filter
Analyzing host...
Found these mounted logical volumes on this host:
logical volume: /dev/mapper/rhvh_dhcp209--193-home
mountpoint: /home
devices: /dev/vda2
logical volume: /dev/mapper/rhvh_dhcp209--193-rhvh--4.1--0.20180126.0+1
mountpoint: /
devices: /dev/vda2
logical volume: /dev/mapper/rhvh_dhcp209--193-swap
mountpoint: [SWAP]
devices: /dev/vda2
logical volume: /dev/mapper/rhvh_dhcp209--193-tmp
mountpoint: /tmp
devices: /dev/vda2
logical volume: /dev/mapper/rhvh_dhcp209--193-var
mountpoint: /var
devices: /dev/vda2
logical volume: /dev/mapper/rhvh_dhcp209--193-var_log
mountpoint: /var/log
devices: /dev/vda2
logical volume: /dev/mapper/rhvh_dhcp209--193-var_log_audit
mountpoint: /var/log/audit
devices: /dev/vda2
This is the recommended LVM filter for this host:
filter = [ "a|^/dev/vda2$|", "r|.*|" ]
This filter will allow LVM to access the local devices used by the
hypervisor, but not shared storage owned by Vdsm. If you add a new
device to the volume group, you will need to edit the filter manually.
Configure LVM filter? [yes,NO] yes
Configuration completed successfully!
Please reboot to verify the LVM configuration.
As /dev/vda is a local disk it is also recommended to ignore it in multipath. Please follow the Documentation - Ignoring Local Disks when Generating Multipath Devices on how to ignore the local disk using the WWID of the device. For example:
# mkdir /etc/multipath/conf.d
# vi /etc/multipath/conf.d/blacklist.conf
blacklist {
wwid SIBM-ESXSST336732LC____F3ET0EP0Q000072428BX1
}
[*] Why it is important to blacklist the local device in mutlipath?
If not configured, in the next boot/upgrade, multipath will take over the device before lvm, lvm would not find it and the machine would fail to boot. For details, see RHV host boot into emergency mode after upgrade .
NOTE: It is not recommended to configure a global_filter in /etc/lvm/lvm.conf, as this could prevent VDSM from seeing block-based storage domains.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.