puppetlabs-lvm
puppetlabs-lvm copied to clipboard
RFC: Not all LVM versions support flags used in facts
Hello all,
I created MODULES-9779 which describes how certains flags used in facts aren't supported with older versions of lvm2 (namely on RHEL 5.11).
For instance, the following flags don't exist in RHEL 5 / lvm2-2.02.88:
- lv_full_name
- lv_dm_path
- lv_layout
- lv_role
- lv_active
- lv_permissions
They respectively appear in:
- lv_full_name: appears in v2_02_108
- lv_dm_path: appears in v2_02_108
- lv_layout: appears in v2_02_110
- lv_role: appears in v2_02_110
- lv_active: appears in v2_02_99
- lv_permissions: appears in v2_02_108
I created the following commit where I create a new fact lvm_version which is the version of lvm2. Based on it, I add supported flags before querying lvm for logical_volumes, physical_volumes and volume_groups.
I'd like to hear your comments about it? Is that the way to do it? As in get the version and work on that? And so on...
Cheers, Mathieu
After reviewing your code you need to adjust for SUSE 11.1, which is on 2.02.39, to handle the lv_path introduced in 2.02.68.
In your code for the logical_volumes.rb fact you have:L
columns = [ 'lv_uuid', 'lv_name', 'lv_path', 'lv_attr', 'lv_size', ] lvm_version = Gem::Version.new(Facter.value(:lvm_version)) columns.push('lv_active') if lvm_version >= Gem::Version.new('2.02.99')
To backport this for Legacy SUSE 11.1, I suggest this change
columns = [ 'lv_uuid', 'lv_name', 'lv_attr', 'lv_size', ] lvm_version = Gem::Version.new(Facter.value(:lvm_version)) columns.push('lv_path') if lvm_version >= Gem::Version.new('2.02.68') columns.push('lv_active') if lvm_version >= Gem::Version.new('2.02.99')
For physical volumes, remove pv_mda_used_count
from columns
Add columns.push('pv_mda_used_count') if lvm_version >= Gem::Version.new('2.02.69')
Other than those two changes, the rest of your code looks great to resolve https://tickets.puppetlabs.com/browse/MODULES-9779.
Hello,
I pushed the changes you suggested, let me know if that's what you wanted.
Cheers.
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
Mathieu Chouquet-Stringer seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.
I can't sign the CLA for some reason, cannot check any of the proper boxes under, they are grayed out and the mouse pointer changes to a 🚫 symbol...