aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@redhat.com>2020-08-17 09:48:27 +0200
committerJake Hunsaker <jhunsake@redhat.com>2020-08-17 10:10:02 -0400
commitee35c914fc46ff924af95528f005e2a3c61aaa62 (patch)
tree634f9182c3f7f872d65e6dfc732c052115f50c80
parent34c77d6902ee1df403dc3836b4092d413fb95350 (diff)
downloadsos-ee35c914fc46ff924af95528f005e2a3c61aaa62.tar.gz
[lvm2] Update LVm commands to support HA-LVM
To support HA-LVM deployments: - add --foreign option in pvs, lvs, vgs and vgdisplay commands - add systemid option to vgs command Resolves: #2202 Signed-off-by: Pavel Moravec <pmoravec@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--sos/report/plugins/lvm2.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/sos/report/plugins/lvm2.py b/sos/report/plugins/lvm2.py
index 8b549338..d4251cd8 100644
--- a/sos/report/plugins/lvm2.py
+++ b/sos/report/plugins/lvm2.py
@@ -50,29 +50,32 @@ class Lvm2(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
# command may attempt to recover on-disk data in some cases.
# This option prevents such changes, allowing safe use of
# locking_type=0.
+ # - use --foreign option in pvs, lvs, vgs and vgdisplay commands
+ # to support HA-LVM deployments
nolock = {'cmd': 'vgdisplay -h', 'output': '--nolocking'}
if bool(SoSPredicate(self, cmd_outputs=nolock)):
lvm_opts = '--config="global{metadata_read_only=1}" --nolocking'
else:
lvm_opts = '--config="global{locking_type=0 metadata_read_only=1}"'
+ lvm_opts_foreign = lvm_opts + ' --foreign'
self.add_cmd_output(
- "vgdisplay -vv %s" % lvm_opts,
+ "vgdisplay -vv %s" % lvm_opts_foreign,
root_symlink="vgdisplay"
)
pvs_cols = 'pv_mda_free,pv_mda_size,pv_mda_count,pv_mda_used_count'
pvs_cols = pvs_cols + ',' + 'pe_start'
vgs_cols = 'vg_mda_count,vg_mda_free,vg_mda_size,vg_mda_used_count'
- vgs_cols = vgs_cols + ',' + 'vg_tags'
+ vgs_cols = vgs_cols + ',' + 'vg_tags,systemid'
lvs_cols = ('lv_tags,devices,lv_kernel_read_ahead,lv_read_ahead,'
'stripes,stripesize')
self.add_cmd_output([
"vgscan -vvv %s" % lvm_opts,
"pvscan -v %s" % lvm_opts,
- "pvs -a -v -o +%s %s" % (pvs_cols, lvm_opts),
- "vgs -v -o +%s %s" % (vgs_cols, lvm_opts),
- "lvs -a -o +%s %s" % (lvs_cols, lvm_opts)
+ "pvs -a -v -o +%s %s" % (pvs_cols, lvm_opts_foreign),
+ "vgs -v -o +%s %s" % (vgs_cols, lvm_opts_foreign),
+ "lvs -a -o +%s %s" % (lvs_cols, lvm_opts_foreign)
])
self.add_copy_spec("/etc/lvm")