insights-core
insights-core copied to clipboard
Consolidate collection of LVM metadata into a single parser using 'lvm fullreport'
LVM metadata is currently collected by several overlapping commands with parsers:
lvs_noheadings pvs_noheadings vgdisplay vgs_noheadings
When collecting the metadata, that means the same (relatively slow) code to scan the system inside each of those commands is run on the client 4 times before each one reports just a part of it. Further, there are some edge cases in the output format of those commands that might trip up the parsers.
For newer systems (from mid-2016, version 2.02.158) lvm2 offers the command 'lvm fullreport' that provides all this information at once in a consistent JSON format ('--reportformat json').
So if the system has 'lvm fullreport' then it should use that to collect the lvm metadata, and expose the JSON directly through a new parser which should merely expose the JSON to be queried by rules in whatever way they wish. The functions offered by the existing parsers could be provided as wrappers around the new one, if compatibility with existing rules needs to be preserved.
Same comment as issue #2554 regarding sos: sosreports calls out to lvmdump to gather its information (which gathers a lot more diagnostics). We could wrap the output for insights with that too, and then sosreport could automatically include identical output to what Insights get. (This would only be for future releases, not when run on systems not upgraded to the release where the change happened.)