diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2015-06-30 18:00:28 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2015-06-30 18:00:28 +0100 |
commit | a5824f209c000d1a69ef305dd69f105400de3f4a (patch) | |
tree | b6233f6ab87b91645f5a66cfa1c77528237a10d7 | |
parent | 8a710151c792a5f8bddba33de29976bb218b6701 (diff) | |
download | sos-a5824f209c000d1a69ef305dd69f105400de3f4a.tar.gz |
[vhostmd] enumerate disks via /sys/block instead of "lsblk -d"
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/vhostmd.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sos/plugins/vhostmd.py b/sos/plugins/vhostmd.py index 786a7c11..0a86fb5f 100644 --- a/sos/plugins/vhostmd.py +++ b/sos/plugins/vhostmd.py @@ -13,6 +13,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. from sos.plugins import Plugin, RedHatPlugin +import os class vhostmd(Plugin, RedHatPlugin): @@ -31,14 +32,16 @@ class vhostmd(Plugin, RedHatPlugin): return if "vmware" in vw or "kvm" in vw or "xen" in vw: - # if vm-dump-metrics is installed use it if self.is_installed("vm-dump-metrics"): + # if vm-dump-metrics is installed use it self.add_cmd_output("vm-dump-metrics", suggest_filename="virt_metrics") else: # otherwise use the raw vhostmd disk presented (256k size) - d = self.get_command_output("lsblk -d") - for disk in d['output'].splitlines(): + sysblock = "/sys/block" + if not os.path.isdir(sysblock): + return + for disk in os.listdir(sysblock): if "256K" in disk: dev = disk.split()[0] check = self.get_command_output( |