Skip to content

Commit

Permalink
topology: add block device topology probe
Browse files Browse the repository at this point in the history
The probe reads JSON from the lsblk command to get a
description of the block devices on the system.  The
JSON is parsed into structures that describe the relationships
between the devices (parent/child,LVM,MD,multipath).

If the environment variable SKYDIVE_BLOCKDEV_TEST_FILE is set
the file is read rather than invoking "lsblk --json".  This is
for testing more complex block device setups that might not
be available on the local system.

Signed-off-by: Todd Gill <tgill@redhat.com>
  • Loading branch information
trgill authored and lebauce committed Dec 30, 2019
1 parent a971198 commit c74da18
Show file tree
Hide file tree
Showing 13 changed files with 1,460 additions and 3 deletions.
4 changes: 4 additions & 0 deletions agent/topology_probes.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/skydive-project/skydive/probe"
tp "github.com/skydive-project/skydive/topology/probes"
"github.com/skydive-project/skydive/topology/probes/bess"
"github.com/skydive-project/skydive/topology/probes/blockdev"
"github.com/skydive-project/skydive/topology/probes/docker"
"github.com/skydive-project/skydive/topology/probes/libvirt"
"github.com/skydive-project/skydive/topology/probes/lldp"
Expand All @@ -44,6 +45,7 @@ import (
)

func registerStaticProbes() {
blockdev.Register()
netlink.Register()
docker.Register()
lldp.Register()
Expand All @@ -59,6 +61,8 @@ func registerStaticProbes() {
// NewTopologyProbe creates a new topology probe
func NewTopologyProbe(name string, ctx tp.Context, bundle *probe.Bundle) (probe.Handler, error) {
switch name {
case "blockdev":
return blockdev.NewProbe(ctx, bundle)
case "netlink":
return netlink.NewProbe(ctx, bundle)
case "netns":
Expand Down
2 changes: 2 additions & 0 deletions analyzer/probes.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/skydive-project/skydive/plugin"
"github.com/skydive-project/skydive/probe"
"github.com/skydive-project/skydive/sflow"
"github.com/skydive-project/skydive/topology/probes/blockdev"
"github.com/skydive-project/skydive/topology/probes/docker"
"github.com/skydive-project/skydive/topology/probes/fabric"
"github.com/skydive-project/skydive/topology/probes/istio"
Expand All @@ -45,6 +46,7 @@ import (

func registerStaticProbes() {
netlink.Register()
blockdev.Register()
docker.Register()
lldp.Register()
lxd.Register()
Expand Down
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func init() {
cfg.SetDefault("agent.flow.sflow.port_max", 6355)
cfg.SetDefault("agent.listen", "127.0.0.1:8081")
cfg.SetDefault("agent.topology.probes", []string{"ovsdb"})
cfg.SetDefault("agent.topology.blockdev.lsblk_path", "/usr/bin/lsblk")
cfg.SetDefault("agent.topology.docker.url", "unix:///var/run/docker.sock")
cfg.SetDefault("agent.topology.docker.netns.run_path", "/var/run/docker/netns")
cfg.SetDefault("agent.topology.netlink.metrics_update", 30)
Expand Down
75 changes: 72 additions & 3 deletions statics/bindata.go

Large diffs are not rendered by default.

Binary file added statics/img/blockdev.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added statics/img/blockdevleaf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added statics/img/blockdevlvm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions statics/js/components/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ var setupFixedImages = function(labelMap) {
};

var nodeImgMap = setupFixedImages({
"blockdev": "blockdev",
"blockdevleaf": "blockdevleaf",
"blockdevlvm": "blockdevlvm",
"host": "host",
"port": "port",
"ovsport": "port",
Expand Down Expand Up @@ -60,6 +63,7 @@ var nodeImgMap = setupFixedImages({
});

var managerImgMap = setupFixedImages({
"blockdev": "blockdev",
"docker": "docker",
"lxd": "lxd",
"neutron": "openstack",
Expand Down
Loading

0 comments on commit c74da18

Please sign in to comment.