VgDisplay - command
Parse the output of the
vg_listproperty 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_listproperty 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
>>> vg_info = shared[VgDisplay] >>> len(vg_info.vg_list) 1 >>> vgdata = vg_info.vg_list >>> vgdata['VG Name'] 'RHEL7CSB' >>> vgdata['VG Size'] '462.76 GiB' >>> 'Logical Volumes' in vgdata True >>> lvs = vgdata['Logical Volumes'] >>> type(lvs) dict >>> lvs.keys() # Note - keyed by device name ['/dev/RHEL7CSB/Root'] >>> lvs['/dev/RHEL7CSB/Root']['LV Name'] 'Root' >>> lvs['/dev/RHEL7CSB/Root']['LV Size'] '29.30 GiB' >>> 'Physical Volumes' in vgdata True >>> vgdata['Physical Volumes'].keys() ['/dev/mapper/luks-96c66446-77fd-4431-9508-f6912bd84194'] >>> vgdata['Physical Volumes']['/dev/mapper/luks-96c66446-77fd-4431-9508-f6912bd84194']['PV UUID'] 'EfWV9V-03CX-E6zc-JkMw-yQae-wdzp-Je1KUn' >>> 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.