diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2014-05-28 15:07:51 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2014-05-28 15:07:51 +0100 |
commit | dd478c24e32a62ad1dcc475dc93bdafe9eac4a7f (patch) | |
tree | bae50ae8ff2c6905003be003c4fd2177d69a94e0 | |
parent | f42f767f1b6c101dcbf6bbf8016fd355b01157ff (diff) | |
download | sos-dd478c24e32a62ad1dcc475dc93bdafe9eac4a7f.tar.gz |
Set global{locking_type=0} when running lvm2 commands
The lvm2 commands that sos issues are all read-only. Disable
locking when running the commands to avoid blocking if another
process or node is holding a lock.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/lvm2.py | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/sos/plugins/lvm2.py b/sos/plugins/lvm2.py index a900fa1e..c54d54df 100644 --- a/sos/plugins/lvm2.py +++ b/sos/plugins/lvm2.py @@ -38,13 +38,24 @@ class Lvm2(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): self.add_cmd_output(cmd) def setup(self): - self.add_cmd_output("vgdisplay -vv", root_symlink = "vgdisplay") + # use locking_type 0 (no locks) when running LVM2 commands, from lvm.conf: + # Turn locking off by setting to 0 (dangerous: risks metadata corruption + # if LVM2 commands get run concurrently). + # None of the commands issued by sos ever modify metadata and this avoids + # the possibility of hanging lvm commands when another process or node + # holds a conflicting lock. + lvm_opts = '--config="global{locking_type=0}"' + + self.add_cmd_output( + "vgdisplay -vv %s" % lvm_opts, + root_symlink="vgdisplay" + ) self.add_cmd_outputs([ - "vgscan -vvv", - "pvscan -v", - "pvs -a -v", - "vgs -v", - "lvs -a -o +devices" + "vgscan -vvv %s" % lvm_opts, + "pvscan -v %s" % lvm_opts, + "pvs -a -v %s" % lvm_opts, + "vgs -v %s" % lvm_opts, + "lvs -a -o +devices %s" % lvm_opts ]) self.add_copy_spec("/etc/lvm") |