diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2020-02-14 16:46:25 +0000 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2020-02-14 16:46:25 +0000 |
commit | 7e4958734f657ce89c8529c2f1228a3015c67209 (patch) | |
tree | 4de893ba0be9d6ac811fe2a242c70b0e2d3d7caa | |
parent | b4f6003b7501d312bf384ae918055f4b7ef3bc9b (diff) | |
download | sos-7e4958734f657ce89c8529c2f1228a3015c67209.tar.gz |
[ebpf] minor style fixes
* Use a PEP8-style class naming
* Don't pass a list for a single add_copy_spec()
* Use a list for multiple commands w/add_cmd_output()
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/ebpf.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sos/plugins/ebpf.py b/sos/plugins/ebpf.py index 0659407a..d5cba96d 100644 --- a/sos/plugins/ebpf.py +++ b/sos/plugins/ebpf.py @@ -10,7 +10,7 @@ from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin import json -class eBPF(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): +class Ebpf(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): plugin_name = 'ebpf' profiles = ('system', 'kernel', 'network') @@ -46,16 +46,18 @@ class eBPF(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): for dumpcmd in ["xlated", "jited"]: self.add_cmd_output("bpftool prog dump %s id %s" % (dumpcmd, prog_id)) + maps = self.collect_cmd_output("bpftool -j map list") for map_id in self.get_bpftool_map_ids(maps['output']): self.add_cmd_output("bpftool map dump id %s" % map_id) - # Iterate over all cgroups and list all attached programs - self.add_cmd_output("bpftool cgroup tree") - - # collect list of bpf program attachments in the kernel - # networking subsystem - self.add_cmd_output("bpftool net list") + self.add_cmd_output([ + # Iterate over all cgroups and list all attached programs + "bpftool cgroup tree", + # collect list of bpf program attachments in the kernel + # networking subsystem + "bpftool net list" + ]) # Capture list of bpf program attachments from namespaces ip_netns = self.exec_cmd("ip netns") @@ -71,8 +73,6 @@ class eBPF(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): out_ns.append(line.partition(' ')[0]) for namespace in out_ns: ns_cmd_prefix = cmd_prefix + namespace + " " - self.add_cmd_output([ - ns_cmd_prefix + "bpftool net list", - ]) + self.add_cmd_output(ns_cmd_prefix + "bpftool net list") # vim: set et ts=4 sw=4 : |