aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2013-08-13 12:37:37 +0100
committerBryn M. Reeves <bmr@redhat.com>2013-08-13 12:37:37 +0100
commit89ef36a72c612cc667d52935f687219981b74240 (patch)
tree9110868ee403bb72d0ce6599422ad288cbe5b24c
parent9ccac531318ae1a4fd98a05bf5ef3e84f2891f42 (diff)
downloadsos-89ef36a72c612cc667d52935f687219981b74240.tar.gz
Rationalise lvm2 plug-in lvmdump options
The lvm2 lvmdump options were a bit crazy, allowing the user to specify a default ('lvmdump'), or an advanced collection ('lvmdump-a') but not the raw metadata ('-m') option which is often useful for support purposes. Replace 'lvmdump-a' with 'lvmdump-am' to collect both. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/lvm2.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/sos/plugins/lvm2.py b/sos/plugins/lvm2.py
index d321e62c..a78642a0 100644
--- a/sos/plugins/lvm2.py
+++ b/sos/plugins/lvm2.py
@@ -22,17 +22,19 @@ class Lvm2(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
plugin_name = 'lvm2'
option_list = [("lvmdump", 'collect an lvmdump tarball', 'fast', False),
- ("lvmdump-am", 'use the -a -m options of lvmdump ' \
- '(implies the "lvmdump" option)', 'slow', False)]
+ ("lvmdump-am", 'attempt to collect an lvmdump with advanced ' \
+ + 'options and raw metadata collection', 'slow', False)]
- def do_lvmdump(self):
+ def do_lvmdump(self, metadata=False):
"""Collects an lvmdump in standard format with optional metadata
archives for each physical volume present.
"""
- lvmdump_cmd = "lvmdump -d '%s'"
- cmd = lvmdump_cmd % os.path.join(self.get_cmd_dir(), "lvmdump")
- if self.get_option('lvmdump-a'):
- cmd += " -a"
+ lvmdump_cmd = "lvmdump %s -d '%s'"
+ lvmdump_opts = ""
+ if metadata:
+ lvmdump_opts = "-a -m"
+ cmd = lvmdump_cmd % (lvmdump_opts,
+ os.path.join(self.get_cmd_dir(), "lvmdump"))
self.add_cmd_output(cmd)
def setup(self):
@@ -47,5 +49,7 @@ class Lvm2(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
if self.get_option('lvmdump'):
self.do_lvmdump()
+ elif self.get_option('lvmdump-am'):
+ self.do_lvmdump(metadata=True)