oVirt / vdsm

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

Check contents of the system.devices file after config-lvm-filter #278

Open aesteve-rh opened 2 years ago

aesteve-rh commented 2 years ago

/etc/lvm/devices/system.devices is created by vdsm-tool config-lvm-filter when vgimportdevices is run. Once created, it does a sanity check with lvmdevices --check, but this is too weak, as it only checks that the format and the contents, but it does not check that it matches the system state.

The contents should look similar the result of running: pvs -o pv_device_id_type,pv_device_id,name,uuid, but only for the relevant devices.

In lvmdevices we receive the VGs that we want to configure in the devicesfile, so we can run something like pvdisplay -C -o vg_name,pv_name and see which pvs are expected, and ensure they appear in the devicesfile.

If it does not match, print an error with the missing devices. Note that printing needs to be done from the tool side, internal logging is hidden.

We may also want to raise or exit with error code from the tool. So in fact we should return a boolean in the lvmdevices.configure, in case the configuration check fails, the tool does not end with a Configuration completed successfully! message.

Related bug: