Skip to content

Commit aeca98c

Browse files
gnufiedjieyu
authored andcommitted
Write a design proposal for volume capacity
Use repeated usage for representing volume stats
1 parent f7a67e7 commit aeca98c

File tree

3 files changed

+611
-258
lines changed

3 files changed

+611
-258
lines changed

csi.proto

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ service Node {
6464
rpc NodeUnpublishVolume (NodeUnpublishVolumeRequest)
6565
returns (NodeUnpublishVolumeResponse) {}
6666

67+
rpc NodeGetVolumeStats (NodeGetVolumeStatsRequest)
68+
returns (NodeGetVolumeStatsResponse) {}
69+
6770
// NodeGetId is being deprecated in favor of NodeGetInfo and will be
6871
// removed in CSI 1.0. Existing drivers, however, may depend on this
6972
// RPC call and hence this RPC call MUST be implemented by the CSI
@@ -1020,6 +1023,44 @@ message NodeUnpublishVolumeRequest {
10201023
message NodeUnpublishVolumeResponse {
10211024
// Intentionally empty.
10221025
}
1026+
message NodeGetVolumeStatsRequest {
1027+
// The ID of the volume. This field is REQUIRED.
1028+
string volume_id = 1;
1029+
1030+
// It can be any valid path where volume was previously
1031+
// staged or published.
1032+
// It MUST be an absolute path in the root filesystem of
1033+
// the process serving this request.
1034+
// This is a REQUIRED field.
1035+
string volume_path = 2;
1036+
}
1037+
1038+
message NodeGetVolumeStatsResponse {
1039+
// This field is OPTIONAL.
1040+
repeated VolumeUsage usage = 1;
1041+
}
1042+
1043+
message VolumeUsage {
1044+
enum Unit {
1045+
UNKNOWN = 0;
1046+
BYTES = 1;
1047+
INODES = 2;
1048+
}
1049+
// The available capacity in specified Unit. This field is OPTIONAL.
1050+
// The value of this field MUST NOT be negative.
1051+
int64 available = 1;
1052+
1053+
// The total capacity in specified Unit. This field is REQUIRED.
1054+
// The value of this field MUST NOT be negative.
1055+
int64 total = 2;
1056+
1057+
// The used capacity in specified Unit. This field is OPTIONAL.
1058+
// The value of this field MUST NOT be negative.
1059+
int64 used = 3;
1060+
1061+
// Units by which values are measured. This field is REQUIRED.
1062+
Unit unit = 4;
1063+
}
10231064
message NodeGetIdRequest {
10241065
// Intentionally empty.
10251066
}
@@ -1046,6 +1087,10 @@ message NodeServiceCapability {
10461087
enum Type {
10471088
UNKNOWN = 0;
10481089
STAGE_UNSTAGE_VOLUME = 1;
1090+
// If Plugin implements GET_VOLUME_STATS capability
1091+
// then it MUST implement NodeGetVolumeStats RPC
1092+
// call for fetching volume statistics.
1093+
GET_VOLUME_STATS = 2;
10491094
}
10501095

10511096
Type type = 1;

0 commit comments

Comments
 (0)