Skip to content

Commit ec6a414

Browse files
committed
Add support for volume expansion to CSI
add support for volume expansion RPC calls. also add plugin capabilities that allow CO to query whether volume expansion is supported online or offline.
1 parent 4027923 commit ec6a414

File tree

3 files changed

+971
-269
lines changed

3 files changed

+971
-269
lines changed

csi.proto

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ service Controller {
5757

5858
rpc ListSnapshots (ListSnapshotsRequest)
5959
returns (ListSnapshotsResponse) {}
60+
61+
rpc ControllerExpandVolume (ControllerExpandVolumeRequest)
62+
returns (ControllerExpandVolumeResponse) {}
6063
}
6164

6265
service Node {
@@ -75,6 +78,11 @@ service Node {
7578
rpc NodeGetVolumeStats (NodeGetVolumeStatsRequest)
7679
returns (NodeGetVolumeStatsResponse) {}
7780

81+
82+
rpc NodeExpandVolume(NodeExpandVolumeRequest)
83+
returns (NodeExpandVolumeResponse) {}
84+
85+
7886
rpc NodeGetCapabilities (NodeGetCapabilitiesRequest)
7987
returns (NodeGetCapabilitiesResponse) {}
8088

@@ -116,7 +124,6 @@ message PluginCapability {
116124
message Service {
117125
enum Type {
118126
UNKNOWN = 0;
119-
120127
// CONTROLLER_SERVICE indicates that the Plugin provides RPCs for
121128
// the ControllerService. Plugins SHOULD provide this capability.
122129
// In rare cases certain plugins MAY wish to omit the
@@ -138,9 +145,55 @@ message PluginCapability {
138145
Type type = 1;
139146
}
140147

148+
message VolumeExpansion {
149+
enum Type {
150+
UNKNOWN = 0;
151+
152+
// ONLINE indicates that volumes may be expanded when published to
153+
// a node. When a Plugin implements this capability it MUST
154+
// implement either the EXPAND_VOLUME controller capability or the
155+
// EXPAND_VOLUME node capability or both. When a plugin supports
156+
// ONLINE volume expansion and also has the EXPAND_VOLUME
157+
// controller capability then the plugin MUST support expansion of
158+
// volumes currently published and available on a node. When a
159+
// plugin supports ONLINE volume expansion and also has the
160+
// EXPAND_VOLUME node capability then the plugin MAY support
161+
// expansion of node-published volume via NodeExpandVolume.
162+
//
163+
// Example 1: Given a shared filesystem volume (e.g. GlusterFs),
164+
// the Plugin may set the ONLINE volume expansion capability and
165+
// implement ControllerExpandVolume but not NodeExpandVolume.
166+
//
167+
// Example 2: Given a block storage volume type (e.g. EBS), the
168+
// Plugin may set the ONLINE volume expansion capability and
169+
// implement both ControllerExpandVolume and NodeExpandVolume.
170+
//
171+
// Example 3: Given a Plugin that supports volume expansion only
172+
// upon a node, the Plugin may set the ONLINE volume
173+
// expansion capability and implement NodeExpandVolume but not
174+
// ControllerExpandVolume.
175+
ONLINE = 1;
176+
177+
// OFFLINE indicates that volumes currently published and
178+
// available on a node SHALL NOT be expanded via
179+
// ControllerExpandVolume. When a plugin supports OFFLINE volume
180+
// expansion it MUST implement either the EXPAND_VOLUME controller
181+
// capability or both the EXPAND_VOLUME controller capability and
182+
// the EXPAND_VOLUME node capability.
183+
//
184+
// Example 1: Given a block storage volume type (e.g. Azure Disk)
185+
// that does not support expansion of "node-attached" (i.e.
186+
// controller-published) volumes, the Plugin may indicate
187+
// OFFLINE volume expansion support and implement both
188+
// ControllerExpandVolume and NodeExpandVolume.
189+
OFFLINE = 2;
190+
}
191+
}
192+
141193
oneof type {
142194
// Service that the plugin supports.
143195
Service service = 1;
196+
VolumeExpansion volume_expansion = 2;
144197
}
145198
}
146199
message ProbeRequest {
@@ -817,14 +870,19 @@ message ControllerServiceCapability {
817870
// snapshot.
818871
CREATE_DELETE_SNAPSHOT = 5;
819872
LIST_SNAPSHOTS = 6;
873+
820874
// Plugins supporting volume cloning at the storage level MAY
821875
// report this capability. The source volume MUST be managed by
822876
// the same plugin. Not all volume sources and parameters
823877
// combinations MAY work.
824878
CLONE_VOLUME = 7;
879+
825880
// Indicates the SP supports ControllerPublishVolume.readonly
826881
// field.
827882
PUBLISH_READONLY = 8;
883+
884+
// See VolumeExpansion for details.
885+
EXPAND_VOLUME = 9;
828886
}
829887

830888
Type type = 1;
@@ -967,6 +1025,28 @@ message ListSnapshotsResponse {
9671025
// An empty string is equal to an unspecified field value.
9681026
string next_token = 2;
9691027
}
1028+
message ControllerExpandVolumeRequest {
1029+
// The ID of the volume to expand. This field is REQUIRED.
1030+
string volume_id = 1;
1031+
1032+
// This allows CO to specify the capacity requirements of the volume
1033+
// after expansion. This field is REQUIRED.
1034+
CapacityRange capacity_range = 2;
1035+
1036+
// Secrets required by the plugin for expanding the volume.
1037+
// This field is OPTIONAL.
1038+
map<string, string> secrets = 3 [(csi_secret) = true];
1039+
}
1040+
1041+
message ControllerExpandVolumeResponse {
1042+
// Capacity of volume after expansion. This field is REQUIRED.
1043+
int64 capacity_bytes = 1;
1044+
1045+
// Whether node expansion is required for the volume. When true
1046+
// the CO MUST make NodeExpandVolume RPC call on the node. This field
1047+
// is REQUIRED.
1048+
bool node_expansion_required = 2;
1049+
}
9701050
message NodeStageVolumeRequest {
9711051
// The ID of the volume to publish. This field is REQUIRED.
9721052
string volume_id = 1;
@@ -1151,6 +1231,8 @@ message NodeServiceCapability {
11511231
// then it MUST implement NodeGetVolumeStats RPC
11521232
// call for fetching volume statistics.
11531233
GET_VOLUME_STATS = 2;
1234+
// See VolumeExpansion for details.
1235+
EXPAND_VOLUME = 3;
11541236
}
11551237

11561238
Type type = 1;
@@ -1201,3 +1283,23 @@ message NodeGetInfoResponse {
12011283
// "Z2".
12021284
Topology accessible_topology = 3;
12031285
}
1286+
message NodeExpandVolumeRequest {
1287+
// The ID of the volume. This field is REQUIRED.
1288+
string volume_id = 1;
1289+
1290+
// The path on which volume is available. This field is REQUIRED.
1291+
string volume_path = 2;
1292+
1293+
// This allows CO to specify the capacity requirements of the volume
1294+
// after expansion. If capacity_range is omitted then a plugin MAY
1295+
// inspect the file system of the volume to determine the maximum
1296+
// capacity to which the volume can be expanded. In such cases a
1297+
// plugin MAY expand the volume to its maximum capacity.
1298+
// This field is OPTIONAL.
1299+
CapacityRange capacity_range = 3;
1300+
}
1301+
1302+
message NodeExpandVolumeResponse {
1303+
// The capacity of the volume in bytes. This field is OPTIONAL.
1304+
int64 capacity_bytes = 1;
1305+
}

0 commit comments

Comments
 (0)