hpe-storage / csi-driver

A Container Storage Interface (CSI) driver from HPE
https://scod.hpedev.io
Apache License 2.0
62 stars 57 forks source link

csi: NodeGetVolumeStats fetch stats from Statfs #253

Closed raunakkumar closed 3 years ago

raunakkumar commented 3 years ago

Test Results:

time="2021-03-30T16:05:21Z" level=info msg="GRPC response: {\"usage\":[{\"available\":10598957056,\"total\":10737418240,\"unit\":1,\"used\":138461184},{\"available\":5242876,\"total\":5242880,\"unit\":2,\"used\":4}]}" file="utils.go:75"

Signed-off-by: Raunak raunak.kumar@hpe.com

raunakkumar commented 3 years ago

As discussed, we will take this feature for next release. Marking it as closed for 1.5

datamattsson commented 3 years ago

Initially we wanted a solution that works both for volumeMode: Block and volumeMode: Filesystem. Not sure statfs will give us that.

raunakkumar commented 3 years ago

Yes agree. I did some research offline and other vendors are using kubernetes/pkg/volume library (https://github.com/kubernetes/kubernetes/blob/master/pkg/volume/metrics_statfs.go#L42) to get stats. For block volume the block size bytes can be retrieved like the aws ebs csi driver below https://github.com/kubernetes-sigs/aws-ebs-csi-driver/blob/master/pkg/driver/node.go#L408-L467