aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2017-01-24 14:59:05 -0500
committerBryn M. Reeves <bmr@redhat.com>2017-03-28 15:54:15 +0100
commit7427a29ca3fc1aedbc783f70a36ea8da32d528f3 (patch)
tree56113bb63412cf78a896a0e6c8719dba584d1f1b
parent3c7d3e1c1f6fe2d6df4ceb8facc0a9ea8c0abc38 (diff)
downloadsos-7427a29ca3fc1aedbc783f70a36ea8da32d528f3.tar.gz
[virsh] Collect host, network, nwfilter, pool and more domain info
This patch adds collection of host information such as memory and capabilities. Additionally, user-defined elements such as networks, nwfilters and storage pools are now collected. A listing of all elements is taken and then, if they exist, the element's xml is collected as well. Further, more domain (vm) information is collected - such as dominfo and domblklist for each domain reported by virsh. Resolves: #918. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--sos/plugins/virsh.py36
1 files changed, 31 insertions, 5 deletions
diff --git a/sos/plugins/virsh.py b/sos/plugins/virsh.py
index a0ad47b4..bc0a35fe 100644
--- a/sos/plugins/virsh.py
+++ b/sos/plugins/virsh.py
@@ -33,15 +33,41 @@ class LibvirtClient(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
else:
self.add_copy_spec("/root/.virt-manager/*")
- # get lit of VMs/domains
- domains_file = self.get_cmd_output_now('virsh -r list --all')
+ cmd = 'virsh -r'
+
+ # get host information
+ subcmds = [
+ 'list --all',
+ 'domcapabilities',
+ 'capabilities',
+ 'nodeinfo',
+ 'freecell',
+ 'node-memory-tune',
+ 'version'
+ ]
+
+ for subcmd in subcmds:
+ self.add_cmd_output('%s %s' % (cmd, subcmd))
+
+ # get network, pool and nwfilter elements
+ for k in ['net', 'nwfilter', 'pool']:
+ self.add_cmd_output('%s %s-list' % (cmd, k))
+ k_file = self.get_cmd_output_now('%s %s-list' % (cmd, k))
+ if k_file:
+ k_lines = open(k_file, 'r').read().splitlines()
+ # the 'name' column position changes between virsh cmds
+ pos = k_lines[0].split().index('Name')
+ for j in filter(lambda x: x, k_lines[2:]):
+ n = j.split()[pos]
+ self.add_cmd_output('%s %s-dumpxml %s' % (cmd, k, n))
# cycle through the VMs/domains list, ignore 2 header lines and latest
# empty line, and dumpxml domain name in 2nd column
+ domains_file = self.get_cmd_output_now('%s list --all' % cmd)
if domains_file:
domains_lines = open(domains_file, "r").read().splitlines()[2:]
for domain in filter(lambda x: x, domains_lines):
- self.add_cmd_output("virsh -r dumpxml %s" % domain.split()[1],
- timeout=180)
-
+ d = domain.split()[1]
+ for x in ['dumpxml', 'dominfo', 'domblklist']:
+ self.add_cmd_output('%s %s %s' % (cmd, x, d))
# vim: et ts=4 sw=4