kwilczynski/facter-facts

Add VG and LV information on mounts

jjperry opened this issue · 3 comments

The details provided by the fact under mounts yields the /dev/mapper/- for the device details.

I happened to come across an issue where I needed to dynamically create a new filesystem across SUSE, RH, and CentOS where the VGs names vary drastically (system,rootvg,vgroot,centos) for the / partition.

Using the mountpoints fact, I extracted the / vg with
Facter.value(:mountpoints)['/']['device'].split(' ')[0].split('/')[3].split('-')[0]
and the LV with
Facter.value(:mountpoints)['/']['device'].split(' ')[0].split('/')[3].split('-')[1]

Would it make any sense to do this within the mountpoints to provide that detail for LVM operations using mountpoints?

Hi @jjperry, thank you for taking the time to open an issue!

What if we add a dedicated fact for volume groups and logical volumes? Would that be something of interest?

Hi @jjperry, after having a quick look, it seems that the puppetlabs-lvm provides facts around LVM (e.g., physical volumes, logical volumes, etc.).

I wonder, if this would be something that you could leverage?

I went that route first, but the bug https://tickets.puppetlabs.com/browse/MODULES-9779 prevents the facts from working on RHEL/CentOS 5, SUSE 10, and SUSE 11.1. Oddly, for SUSE 11.2 - 11.4, the facts do not generate any VG or LV data, returning instead {}.

Though I do see that it is does seem to pull lvm_vg_X, but no LVM data for the legacy OSes.

The LVM data provided by the facts don't give the Volume Group either.

logical_volumes => {
lvroot => {
uuid => "c058ah-dJ5O-jEhv-dNii-6chf-pzlC-i9CUYc",
full_name => "system/lvroot",
path => "/dev/system/lvroot",
dm_path => "/dev/mapper/system-lvroot",
attr => "-wi-ao----",
layout => "linear",
role => "public",
active => "active",
size => "2.78g",
permissions => "writeable"
},

Having dedicated facts to VGs and LVs, which work with Legacy OSes as well, would be very beneficial. Without the LVM module installed, you also can't access the Volume Groups and Logical Volumes in the facts section for a host in Foreman. It complains about .../parent_facts/<volume_groups|logical_volumes>not having data.