VgDisplay - command vgdisplay

class insights.parsers.vgdisplay.VgDisplay(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser

Parse the output of the vgdisplay -vv or vgdisplay commands.

The vg_list property is the main access to the list of volume groups in the command output. Each volume group is stored as a dictionary of keys and values drawn from the property list of the volume group. The volume group’s logical and physical volumes are stored in the ‘Logical Volumes’ and ‘Physical Volumes’ sub-keys, respectively.

Sample command output of vgdisplay -vv (pruned for clarity):

Couldn't find device with uuid VVLmw8-e2AA-ECfW-wDPl-Vnaa-0wW1-utv7tV.

--- Volume group ---
VG Name               RHEL7CSB
System ID
Format                lvm2
Metadata Areas        1
Metadata Sequence No  13

--- Logical volume ---
LV Path                /dev/RHEL7CSB/Root
LV Name                Root
VG Name                RHEL7CSB
LV Size                29.30 GiB

--- Physical volumes ---
PV Name               /dev/mapper/luks-96c66446-77fd-4431-9508-f6912bd84194
PV UUID               EfWV9V-03CX-E6zc-JkMw-yQae-wdzp-Je1KUn
PV Status             allocatable
Total PE / Free PE    118466 / 4036

Volume groups are kept in the vg_list property in the order they were found in the file.

Lines containing ‘Couldn’t find device with uuid’ and ‘missing physical volume’ are stored in a debug_info property.


>>> vg_info = shared[VgDisplay]
>>> len(vg_info.vg_list)
>>> vgdata = vg_info.vg_list[0]
>>> vgdata['VG Name']
>>> vgdata['VG Size']
'462.76 GiB'
>>> 'Logical Volumes' in vgdata
>>> lvs = vgdata['Logical Volumes']
>>> type(lvs)
>>> lvs.keys()  # Note - keyed by device name
>>> lvs['/dev/RHEL7CSB/Root']['LV Name']
>>> lvs['/dev/RHEL7CSB/Root']['LV Size']
'29.30 GiB'
>>> 'Physical Volumes' in vgdata
>>> vgdata['Physical Volumes'].keys()
>>> vgdata['Physical Volumes']['/dev/mapper/luks-96c66446-77fd-4431-9508-f6912bd84194']['PV UUID']
>>> vg_info.debug_info
["Couldn't find device with uuid VVLmw8-e2AA-ECfW-wDPl-Vnaa-0wW1-utv7tV."]

This method must be implemented by classes based on this class.