Skip to content

Commit dd6510f

Browse files
author
James DeFelice
committed
spec: default field sizes; clarify OPTIONAL fields
1 parent 00095b2 commit dd6510f

File tree

3 files changed

+66
-39
lines changed

3 files changed

+66
-39
lines changed

csi.proto

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ message VolumeCapability {
181181
// Indicate that the volume will be accessed via the filesystem API.
182182
message MountVolume {
183183
// The filesystem type. This field is OPTIONAL.
184+
// An empty string is equal to an unspecified field value.
184185
string fs_type = 1;
185186

186187
// The mount options that can be used for the volume. This field is
@@ -232,24 +233,25 @@ message VolumeCapability {
232233
// `required_bytes` and `limit_bytes` can be set to the same value. At
233234
// least one of the these fields MUST be specified.
234235
message CapacityRange {
235-
// Volume must be at least this big.
236+
// Volume must be at least this big. This field is OPTIONAL.
237+
// A value of 0 is equal to an unspecified field value.
236238
uint64 required_bytes = 1;
237239

238-
// Volume must not be bigger than this.
240+
// Volume must not be bigger than this. This field is OPTIONAL.
241+
// A value of 0 is equal to an unspecified field value.
239242
uint64 limit_bytes = 2;
240243
}
241244

242245
// The information about a provisioned volume.
243246
message VolumeInfo {
244247
// The capacity of the volume in bytes. This field is OPTIONAL. If not
245-
// set, it indicates that the capacity of the volume is unknown (e.g.,
246-
// NFS share). If set, it MUST be non-zero.
248+
// set (value of 0), it indicates that the capacity of the volume is
249+
// unknown (e.g., NFS share).
247250
uint64 capacity_bytes = 1;
248251

249252
// Contains identity information for the created volume. This field is
250253
// REQUIRED. The identity information will be used by the CO in
251-
// subsequent calls to refer to the provisioned volume. This field
252-
// should not exceed 1MiB.
254+
// subsequent calls to refer to the provisioned volume.
253255
string id = 2;
254256

255257
// Attributes reflect static properties of a volume and MUST be passed
@@ -421,6 +423,7 @@ message ValidateVolumeCapabilitiesResponse {
421423

422424
// Message to the CO if `supported` above is false. This field is
423425
// OPTIONAL.
426+
// An empty string is equal to an unspecified field value.
424427
string message = 2;
425428
}
426429

@@ -436,18 +439,19 @@ message ListVolumesRequest {
436439
// The API version assumed by the CO. This field is REQUIRED.
437440
Version version = 1;
438441

439-
// If specified, the Plugin MUST NOT return more entries than this
440-
// number in the response. If the actual number of entries is more
441-
// than this number, the Plugin MUST set `next_token` in the response
442-
// which can be used to get the next page of entries in the subsequent
443-
// `ListVolumes` call. This field is OPTIONAL. If not specified, it
444-
// means there is no restriction on the number of entries that can be
445-
// returned.
442+
// If specified (non-zero value), the Plugin MUST NOT return more
443+
// entries than this number in the response. If the actual number of
444+
// entries is more than this number, the Plugin MUST set `next_token`
445+
// in the response which can be used to get the next page of entries
446+
// in the subsequent `ListVolumes` call. This field is OPTIONAL. If
447+
// not specified (zero value), it means there is no restriction on the
448+
// number of entries that can be returned.
446449
uint32 max_entries = 2;
447450

448451
// A token to specify where to start paginating. Set this field to
449452
// `next_token` returned by a previous `ListVolumes` call to get the
450453
// next page of entries. This field is OPTIONAL.
454+
// An empty string is equal to an unspecified field value.
451455
string starting_token = 3;
452456
}
453457

@@ -464,6 +468,7 @@ message ListVolumesResponse {
464468
// `max_entries`, use the `next_token` as a value for the
465469
// `starting_token` field in the next `ListVolumes` request. This
466470
// field is OPTIONAL.
471+
// An empty string is equal to an unspecified field value.
467472
string next_token = 2;
468473
}
469474

lib/go/csi/csi.pb.go

Lines changed: 18 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec.md

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,18 @@ However, in some circumstances, the CO may lose state (for example when the CO c
295295
The plugin should handle this as gracefully as possible.
296296
The error code `OPERATION_PENDING_FOR_VOLUME` may be returned by the plugin in this case (see general error code section for details).
297297

298+
#### Field Size Limits
299+
300+
CSI defines general size limits for fields of various types (see table below).
301+
The general size limit for a particular field may be overridden by specifying a different size limit in said field's description.
302+
The general size limits apply for messages generated by both COs and plugins.
303+
304+
| Size | Field Type |
305+
|------------|---------------------|
306+
| 128 bytes | string |
307+
| 4 KiB | map<string, string> |
308+
| 4 KiB | repeated string |
309+
298310
### Identity Service RPC
299311

300312
Identity service RPCs allow a CO to negotiate an API protocol version that MAY be used for subsequent RPCs across all CSI services with respect to a particular CSI plugin.
@@ -476,6 +488,7 @@ message VolumeCapability {
476488
// Indicate that the volume will be accessed via the filesystem API.
477489
message MountVolume {
478490
// The filesystem type. This field is OPTIONAL.
491+
// An empty string is equal to an unspecified field value.
479492
string fs_type = 1;
480493
481494
// The mount options that can be used for the volume. This field is
@@ -527,24 +540,25 @@ message VolumeCapability {
527540
// `required_bytes` and `limit_bytes` can be set to the same value. At
528541
// least one of the these fields MUST be specified.
529542
message CapacityRange {
530-
// Volume must be at least this big.
543+
// Volume must be at least this big. This field is OPTIONAL.
544+
// A value of 0 is equal to an unspecified field value.
531545
uint64 required_bytes = 1;
532546
533-
// Volume must not be bigger than this.
547+
// Volume must not be bigger than this. This field is OPTIONAL.
548+
// A value of 0 is equal to an unspecified field value.
534549
uint64 limit_bytes = 2;
535550
}
536551
537552
// The information about a provisioned volume.
538553
message VolumeInfo {
539554
// The capacity of the volume in bytes. This field is OPTIONAL. If not
540-
// set, it indicates that the capacity of the volume is unknown (e.g.,
541-
// NFS share). If set, it MUST be non-zero.
555+
// set (value of 0), it indicates that the capacity of the volume is
556+
// unknown (e.g., NFS share).
542557
uint64 capacity_bytes = 1;
543558
544559
// Contains identity information for the created volume. This field is
545560
// REQUIRED. The identity information will be used by the CO in
546-
// subsequent calls to refer to the provisioned volume. This field
547-
// should not exceed 1MiB.
561+
// subsequent calls to refer to the provisioned volume.
548562
string id = 2;
549563
550564
// Attributes reflect static properties of a volume and MUST be passed
@@ -761,6 +775,7 @@ message ValidateVolumeCapabilitiesResponse {
761775
762776
// Message to the CO if `supported` above is false. This field is
763777
// OPTIONAL.
778+
// An empty string is equal to an unspecified field value.
764779
string message = 2;
765780
}
766781
@@ -782,18 +797,19 @@ message ListVolumesRequest {
782797
// The API version assumed by the CO. This field is REQUIRED.
783798
Version version = 1;
784799
785-
// If specified, the Plugin MUST NOT return more entries than this
786-
// number in the response. If the actual number of entries is more
787-
// than this number, the Plugin MUST set `next_token` in the response
788-
// which can be used to get the next page of entries in the subsequent
789-
// `ListVolumes` call. This field is OPTIONAL. If not specified, it
790-
// means there is no restriction on the number of entries that can be
791-
// returned.
800+
// If specified (non-zero value), the Plugin MUST NOT return more
801+
// entries than this number in the response. If the actual number of
802+
// entries is more than this number, the Plugin MUST set `next_token`
803+
// in the response which can be used to get the next page of entries
804+
// in the subsequent `ListVolumes` call. This field is OPTIONAL. If
805+
// not specified (zero value), it means there is no restriction on the
806+
// number of entries that can be returned.
792807
uint32 max_entries = 2;
793808
794809
// A token to specify where to start paginating. Set this field to
795810
// `next_token` returned by a previous `ListVolumes` call to get the
796811
// next page of entries. This field is OPTIONAL.
812+
// An empty string is equal to an unspecified field value.
797813
string starting_token = 3;
798814
}
799815
@@ -810,6 +826,7 @@ message ListVolumesResponse {
810826
// `max_entries`, use the `next_token` as a value for the
811827
// `starting_token` field in the next `ListVolumes` request. This
812828
// field is OPTIONAL.
829+
// An empty string is equal to an unspecified field value.
813830
string next_token = 2;
814831
}
815832

0 commit comments

Comments
 (0)