Skip to content

Commit 70e7ca5

Browse files
committed
spec: Move AccessMode to VolumeCapability
This patch moved `AccessMode` to `VolumeCapability`, because access mode is strongly related to the filesystem type. For instance, a plugin might support `SINGLE_NODE_WRITER` for `xfs`, and `MULTI_NODE_READER_ONLY` for `gfs2`. This patch also removed `VolumeCapability` fields from `ControllerGetCapabilities` and `NodeGetCapabilities` RPCs. It becomes very tedious to ask the plugins to enumerate all volume capabilities that a plugin supports, and probably provides less value. To check the capablities of a volume, the CO should use `ValidateVolumeCapabilities`. This applies to both newly provisioned volumes and pre-existing volumes. See discussion in #61.
1 parent e695e2f commit 70e7ca5

File tree

3 files changed

+457
-498
lines changed

3 files changed

+457
-498
lines changed

csi.proto

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,12 @@ message CreateVolumeResponse {
165165

166166
// Specify a capability of a volume.
167167
message VolumeCapability {
168+
// Indicate that the volume will be accessed via the block device API.
168169
message BlockVolume {
169170
// Intentionally empty, for now.
170171
}
172+
173+
// Indicate that the volume will be accessed via the filesystem API.
171174
message MountVolume {
172175
// The filesystem type. This field is OPTIONAL.
173176
string fs_type = 1;
@@ -179,11 +182,41 @@ message VolumeCapability {
179182
repeated string mount_flags = 2;
180183
}
181184

182-
// One of the following fields MUST be specified.
183-
oneof value {
185+
// Specify how a volume can be accessed.
186+
message AccessMode {
187+
enum Mode {
188+
UNKNOWN = 0;
189+
190+
// Can be published as read/write at one node at a time.
191+
SINGLE_NODE_WRITER = 1;
192+
193+
// Can be published as readonly at one node at a time.
194+
SINGLE_NODE_READER_ONLY = 2;
195+
196+
// Can be published as readonly at multiple nodes simultaneously.
197+
MULTI_NODE_READER_ONLY = 3;
198+
199+
// Can be published at multiple nodes simultaneously. Only one of
200+
// the node can be used as read/write. The rest will be readonly.
201+
MULTI_NODE_SINGLE_WRITER = 4;
202+
203+
// Can be published as read/write at multiple nodes simultaneously.
204+
MULTI_NODE_MULTI_WRITER = 5;
205+
}
206+
207+
// This field is REQUIRED.
208+
Mode mode = 1;
209+
}
210+
211+
// Specifies what API the volume will be accessed using. One of the
212+
// following fields MUST be specified.
213+
oneof access_type {
184214
BlockVolume block = 1;
185215
MountVolume mount = 2;
186216
}
217+
218+
// This is a REQUIRED field.
219+
AccessMode access_mode = 3;
187220
}
188221

189222
// The capacity of the storage space in bytes. To specify an exact size,
@@ -204,10 +237,6 @@ message VolumeInfo {
204237
// NFS share). If set, it MUST be non-zero.
205238
uint64 capacity_bytes = 1;
206239

207-
// Contains information about how the volume can be accessed. This
208-
// field is REQUIRED.
209-
AccessMode access_mode = 2;
210-
211240
// Contains identity information for the created volume. This field is
212241
// REQUIRED. The identity information will be used by the CO in
213242
// subsequent calls to refer to the provisioned volume.
@@ -219,32 +248,6 @@ message VolumeInfo {
219248
VolumeMetadata metadata = 5;
220249
}
221250

222-
// Specify how a volume can be accessed.
223-
message AccessMode {
224-
enum Mode {
225-
UNKNOWN = 0;
226-
227-
// Can be published as read/write at one node at a time.
228-
SINGLE_NODE_WRITER = 1;
229-
230-
// Can be published as readonly at one node at a time.
231-
SINGLE_NODE_READER_ONLY = 2;
232-
233-
// Can be published as readonly at multiple nodes simultaneously.
234-
MULTI_NODE_READER_ONLY = 3;
235-
236-
// Can be published at multiple nodes simultaneously. Only one of
237-
// the node can be used as read/write. The rest will be readonly.
238-
MULTI_NODE_SINGLE_WRITER = 4;
239-
240-
// Can be published as read/write at multiple nodes simultaneously.
241-
MULTI_NODE_MULTI_WRITER = 5;
242-
}
243-
244-
// This field is REQUIRED.
245-
Mode mode = 1;
246-
}
247-
248251
// The identity of the volume.
249252
message VolumeID {
250253
// The identity of the provisioned volume specified by the Plugin in
@@ -306,6 +309,10 @@ message ControllerPublishVolumeRequest {
306309
// in such cases the CO SHALL NOT specify this field.
307310
NodeID node_id = 4;
308311

312+
// The capability of the volume the CO expects the volume to have.
313+
// This is a REQUIRED field.
314+
VolumeCapability volume_capability = 6;
315+
309316
// Whether to publish the volume in readonly mode. This field is
310317
// REQUIRED.
311318
bool readonly = 5;
@@ -510,12 +517,6 @@ message ControllerServiceCapability {
510517
oneof type {
511518
// RPC that the controller supports.
512519
RPC rpc = 1;
513-
514-
// Volume capability the Controller Plugin supports. An SP SHOULD
515-
// avoid setting different volume capability for Controller and Node
516-
// Plugins if possible. If this happens during the upgrade of the
517-
// Plugins, the behavior is UNDEFINED.
518-
VolumeCapability volume_capability = 2;
519520
}
520521
}
521522
////////
@@ -542,8 +543,8 @@ message NodePublishVolumeRequest {
542543
// request. This is a REQUIRED field.
543544
string target_path = 5;
544545

545-
// The capability of the volume to be published. This is a REQUIRED
546-
// field.
546+
// The capability of the volume the CO expects the volume to have.
547+
// This is a REQUIRED field.
547548
VolumeCapability volume_capability = 6;
548549

549550
// Whether to publish the volume in readonly mode. This field is
@@ -659,12 +660,6 @@ message NodeServiceCapability {
659660
oneof type {
660661
// RPC that the controller supports.
661662
RPC rpc = 1;
662-
663-
// Volume capability the Node Plugin supports. An SP SHOULD avoid
664-
// setting different volume capability for Controller and Node
665-
// Plugins if possible. If this happens during the upgrade of the
666-
// Plugins, the behavior is UNDEFINED.
667-
VolumeCapability volume_capability = 2;
668663
}
669664
}
670665
////////
@@ -971,6 +966,10 @@ message Error {
971966
// retrying with exponential backoff.
972967
MAX_ATTACHED_NODES = 8;
973968

969+
UNSUPPORTED_MOUNT_FLAGS = 10;
970+
UNSUPPORTED_VOLUME_TYPE = 11;
971+
UNSUPPORTED_FS_TYPE = 12;
972+
974973
// Indicates that the specified `NodeID` is not allowed or
975974
// understood by the Plugin, or the Plugin does not support the
976975
// operation without a `NodeID`. More human-readable information

0 commit comments

Comments
 (0)