Report "available" space rather than "free" space in volume stats
These two numbers may differ, and having the wrong number may result in a volume having no useable space, while the metrics suggest it does.
This commit is contained in:
parent
1cd4ca3d1f
commit
87e78705b1
8
bd2fs.py
8
bd2fs.py
@ -124,15 +124,15 @@ class Bd2FsNodeServicer(csi_pb2_grpc.NodeServicer):
|
|||||||
return csi_pb2.NodeGetVolumeStatsResponse(
|
return csi_pb2.NodeGetVolumeStatsResponse(
|
||||||
usage=[
|
usage=[
|
||||||
csi_pb2.VolumeUsage(
|
csi_pb2.VolumeUsage(
|
||||||
available=stats["fs_free"],
|
available=stats["fs_avail"],
|
||||||
total=stats["fs_size"],
|
total=stats["fs_size"],
|
||||||
used=stats["fs_size"] - stats["fs_free"],
|
used=stats["fs_size"] - stats["fs_avail"],
|
||||||
unit=csi_pb2.VolumeUsage.Unit.BYTES,
|
unit=csi_pb2.VolumeUsage.Unit.BYTES,
|
||||||
),
|
),
|
||||||
csi_pb2.VolumeUsage(
|
csi_pb2.VolumeUsage(
|
||||||
available=stats["fs_files_free"],
|
available=stats["fs_files_avail"],
|
||||||
total=stats["fs_files"],
|
total=stats["fs_files"],
|
||||||
used=stats["fs_files"] - stats["fs_files_free"],
|
used=stats["fs_files"] - stats["fs_files_avail"],
|
||||||
unit=csi_pb2.VolumeUsage.Unit.INODES,
|
unit=csi_pb2.VolumeUsage.Unit.INODES,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -10,9 +10,9 @@ def path_stats(path):
|
|||||||
fs_stat = os.statvfs(path)
|
fs_stat = os.statvfs(path)
|
||||||
return {
|
return {
|
||||||
"fs_size": fs_stat.f_frsize * fs_stat.f_blocks,
|
"fs_size": fs_stat.f_frsize * fs_stat.f_blocks,
|
||||||
"fs_free": fs_stat.f_frsize * fs_stat.f_bfree,
|
"fs_avail": fs_stat.f_frsize * fs_stat.f_bavail,
|
||||||
"fs_files": fs_stat.f_files,
|
"fs_files": fs_stat.f_files,
|
||||||
"fs_files_free": fs_stat.f_ffree,
|
"fs_files_avail": fs_stat.f_favail,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user