Skip to content

Commit e129a75

Browse files
authored
Merge pull request #415 from xing-yang/volumehealth
Add Volume Health Support to CSI
2 parents e4404c3 + ecaa329 commit e129a75

File tree

3 files changed

+791
-267
lines changed

3 files changed

+791
-267
lines changed

csi.proto

+94
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ service Controller {
9595

9696
rpc ControllerExpandVolume (ControllerExpandVolumeRequest)
9797
returns (ControllerExpandVolumeResponse) {}
98+
99+
rpc ControllerGetVolume (ControllerGetVolumeRequest)
100+
returns (ControllerGetVolumeResponse) {
101+
option (alpha_method) = true;
102+
}
98103
}
99104

100105
service Node {
@@ -849,6 +854,12 @@ message ListVolumesResponse {
849854
// published_node_ids MAY include nodes not published to or
850855
// reported by the SP. The CO MUST be resilient to that.
851856
repeated string published_node_ids = 1;
857+
858+
// Information about the current condition of the volume.
859+
// This field is OPTIONAL.
860+
// This field MUST be specified if the
861+
// VOLUME_CONDITION controller capability is supported.
862+
VolumeCondition volume_condition = 2 [(alpha_field) = true];
852863
}
853864

854865
message Entry {
@@ -871,6 +882,40 @@ message ListVolumesResponse {
871882
// An empty string is equal to an unspecified field value.
872883
string next_token = 2;
873884
}
885+
message ControllerGetVolumeRequest {
886+
option (alpha_message) = true;
887+
888+
// The ID of the volume to fetch current volume information for.
889+
// This field is REQUIRED.
890+
string volume_id = 1;
891+
}
892+
893+
message ControllerGetVolumeResponse {
894+
option (alpha_message) = true;
895+
896+
message VolumeStatus{
897+
// A list of all the `node_id` of nodes that this volume is
898+
// controller published on.
899+
// This field is OPTIONAL.
900+
// This field MUST be specified if the PUBLISH_UNPUBLISH_VOLUME
901+
// controller capability is supported.
902+
// published_node_ids MAY include nodes not published to or
903+
// reported by the SP. The CO MUST be resilient to that.
904+
repeated string published_node_ids = 1;
905+
906+
// Information about the current condition of the volume.
907+
// This field is OPTIONAL.
908+
// This field MUST be specified if the
909+
// VOLUME_CONDITION controller capability is supported.
910+
VolumeCondition volume_condition = 2;
911+
}
912+
913+
// This field is REQUIRED
914+
Volume volume = 1;
915+
916+
// This field is REQUIRED.
917+
VolumeStatus status = 2;
918+
}
874919
message GetCapacityRequest {
875920
// If specified, the Plugin SHALL report the capacity of the storage
876921
// that can be used to provision volumes that satisfy ALL of the
@@ -945,6 +990,24 @@ message ControllerServiceCapability {
945990
// Indicates the SP supports the
946991
// ListVolumesResponse.entry.published_nodes field
947992
LIST_VOLUMES_PUBLISHED_NODES = 10;
993+
994+
// Indicates that the Controller service can report volume
995+
// conditions.
996+
// An SP MAY implement `VolumeCondition` in only the Controller
997+
// Plugin, only the Node Plugin, or both.
998+
// If `VolumeCondition` is implemented in both the Controller and
999+
// Node Plugins, it SHALL report from different perspectives.
1000+
// If for some reason Controller and Node Plugins report
1001+
// misaligned volume conditions, CO SHALL assume the worst case
1002+
// is the truth.
1003+
// Note that, for alpha, `VolumeCondition` is intended be
1004+
// informative for humans only, not for automation.
1005+
VOLUME_CONDITION = 11 [(alpha_enum_value) = true];
1006+
1007+
// Indicates the SP supports the ControllerGetVolume RPC.
1008+
// This enables COs to, for example, fetch per volume
1009+
// condition after a volume is provisioned.
1010+
GET_VOLUME = 12 [(alpha_enum_value) = true];
9481011
}
9491012

9501013
Type type = 1;
@@ -1273,6 +1336,11 @@ message NodeGetVolumeStatsRequest {
12731336
message NodeGetVolumeStatsResponse {
12741337
// This field is OPTIONAL.
12751338
repeated VolumeUsage usage = 1;
1339+
// Information about the current condition of the volume.
1340+
// This field is OPTIONAL.
1341+
// This field MUST be specified if the VOLUME_CONDITION node
1342+
// capability is supported.
1343+
VolumeCondition volume_condition = 2 [(alpha_field) = true];
12761344
}
12771345

12781346
message VolumeUsage {
@@ -1296,6 +1364,20 @@ message VolumeUsage {
12961364
// Units by which values are measured. This field is REQUIRED.
12971365
Unit unit = 4;
12981366
}
1367+
1368+
// VolumeCondition represents the current condition of a volume.
1369+
message VolumeCondition {
1370+
option (alpha_message) = true;
1371+
1372+
// Normal volumes are available for use and operating optimally.
1373+
// An abnormal volume does not meet these criteria.
1374+
// This field is REQUIRED.
1375+
bool abnormal = 1;
1376+
1377+
// The message describing the condition of the volume.
1378+
// This field is REQUIRED.
1379+
string message = 2;
1380+
}
12991381
message NodeGetCapabilitiesRequest {
13001382
// Intentionally empty.
13011383
}
@@ -1318,6 +1400,18 @@ message NodeServiceCapability {
13181400
GET_VOLUME_STATS = 2;
13191401
// See VolumeExpansion for details.
13201402
EXPAND_VOLUME = 3;
1403+
// Indicates that the Node service can report volume conditions.
1404+
// An SP MAY implement `VolumeCondition` in only the Node
1405+
// Plugin, only the Controller Plugin, or both.
1406+
// If `VolumeCondition` is implemented in both the Node and
1407+
// Controller Plugins, it SHALL report from different
1408+
// perspectives.
1409+
// If for some reason Node and Controller Plugins report
1410+
// misaligned volume conditions, CO SHALL assume the worst case
1411+
// is the truth.
1412+
// Note that, for alpha, `VolumeCondition` is intended to be
1413+
// informative for humans only, not for automation.
1414+
VOLUME_CONDITION = 4 [(alpha_enum_value) = true];
13211415
}
13221416

13231417
Type type = 1;

0 commit comments

Comments
 (0)