Skip to content

Commit

Permalink
expose capability, fix, and log metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Henni authored and matthiaslee committed Oct 14, 2020
1 parent 33985e1 commit 7ffa093
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ require (
github.com/onsi/gomega v1.7.0
github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6 // indirect
golang.org/x/net v0.0.0-20200226051749-491c5fce7268 // indirect
golang.org/x/sys v0.0.0-20191220220014-0732a990476f
google.golang.org/grpc v1.26.0
k8s.io/api v0.17.3
k8s.io/apimachinery v0.17.3
Expand Down
5 changes: 4 additions & 1 deletion pkg/driver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var (
nodeCaps = []csi.NodeServiceCapability_RPC_Type{
csi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME,
csi.NodeServiceCapability_RPC_EXPAND_VOLUME,
csi.NodeServiceCapability_RPC_GET_VOLUME_STATS,
}
)

Expand Down Expand Up @@ -347,6 +348,7 @@ func (d *nodeService) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
}

func (d *nodeService) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error) {
klog.V(4).Infof("NodeGetVolumeStats: called with args %+v", *req)

if len(req.VolumeId) == 0 {
return nil, status.Error(codes.InvalidArgument, "NodeGetVolumeStats volume ID was empty")
Expand Down Expand Up @@ -610,7 +612,8 @@ func hasMountOption(options []string, opt string) bool {
}

func (d *nodeService) getBlockSizeBytes(devicePath string) (int64, error) {
output, err := d.mounter.Run("blockdev", "--getsize64", devicePath)
cmd := d.mounter.Command("blockdev", "--getsize64", devicePath)
output, err := cmd.Output()
if err != nil {
return -1, fmt.Errorf("error when getting size of block volume at path %s: output: %s, err: %v", devicePath, string(output), err)
}
Expand Down

0 comments on commit 7ffa093

Please sign in to comment.