Skip to content

Commit 0bd38c2

Browse files
committed
NodePublishDevice
This patch handles issue container-storage-interface#119 by adding two new RPCs, "NodePublishDevice" and "NodeUnpublishDevice". These RPCs MUST be called by the CO if the Node Plugin advertises the "PUBLISH_UNPUBLISH_DEVICE" capability. Plugins that advertise this capability SHOULD defer volume reference counting to the CO.
1 parent f8340d3 commit 0bd38c2

File tree

3 files changed

+1336
-244
lines changed

3 files changed

+1336
-244
lines changed

csi.proto

Lines changed: 182 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ service Controller {
3838
}
3939

4040
service Node {
41+
rpc NodePublishDevice (NodePublishDeviceRequest)
42+
returns (NodePublishDeviceResponse) {}
43+
44+
rpc NodeUnpublishDevice (NodeUnpublishDeviceRequest)
45+
returns (NodeUnpublishDeviceResponse) {}
46+
4147
rpc NodePublishVolume (NodePublishVolumeRequest)
4248
returns (NodePublishVolumeResponse) {}
4349

@@ -322,7 +328,8 @@ message ControllerPublishVolumeRequest {
322328
message ControllerPublishVolumeResponse {
323329
message Result {
324330
// The SP specific information that will be passed to the Plugin in
325-
// the subsequent `NodePublishVolume` call for the given volume.
331+
// the subsequent `NodePublishDevice` and `NodePublishVolume` calls
332+
// for the given volume.
326333
// This information is opaque to the CO. This field is OPTIONAL.
327334
PublishVolumeInfo publish_volume_info = 1;
328335
}
@@ -530,6 +537,74 @@ message ControllerServiceCapability {
530537
}
531538
////////
532539
////////
540+
message NodePublishDeviceRequest {
541+
// The API version assumed by the CO. This is a REQUIRED field.
542+
Version version = 1;
543+
544+
// The ID of the volume to publish. This field is REQUIRED.
545+
string volume_id = 2;
546+
547+
// The CO SHALL set this field to the value returned by
548+
// `ControllerPublishVolume` if the corresponding Controller Plugin
549+
// has `PUBLISH_UNPUBLISH_VOLUME` controller capability, and SHALL be
550+
// left unset if the corresponding Controller Plugin does not have
551+
// this capability. This is an OPTIONAL field.
552+
PublishVolumeInfo publish_volume_info = 3;
553+
554+
// The path to which the volume will be published. It MUST be an
555+
// absolute path in the root filesystem of the process serving this
556+
// request. The CO SHALL ensure uniqueness of mount_path per volume.
557+
// This is a REQUIRED field.
558+
string mount_path = 4;
559+
560+
// The capability of the volume the CO expects the volume to have.
561+
// This is a REQUIRED field.
562+
VolumeCapability volume_capability = 5;
563+
564+
// End user credentials used to authenticate/authorize node publish
565+
// request. This field is OPTIONAL.
566+
Credentials user_credentials = 6;
567+
}
568+
569+
message NodePublishDeviceResponse {
570+
message Result {}
571+
572+
// One of the following fields MUST be specified.
573+
oneof reply {
574+
Result result = 1;
575+
Error error = 2;
576+
}
577+
}
578+
////////
579+
////////
580+
message NodeUnpublishDeviceRequest {
581+
// The API version assumed by the CO. This is a REQUIRED field.
582+
Version version = 1;
583+
584+
// The ID of the volume. This field is REQUIRED.
585+
string volume_id = 2;
586+
587+
// The path at which the volume was published. It MUST be an absolute
588+
// path in the root filesystem of the process serving this request.
589+
// This is a REQUIRED field.
590+
string mount_path = 3;
591+
592+
// End user credentials used to authenticate/authorize node unpublish
593+
// request. This field is OPTIONAL.
594+
Credentials user_credentials = 4;
595+
}
596+
597+
message NodeUnpublishDeviceResponse {
598+
message Result {}
599+
600+
// One of the following fields MUST be specified.
601+
oneof reply {
602+
Result result = 1;
603+
Error error = 2;
604+
}
605+
}
606+
////////
607+
////////
533608
message NodePublishVolumeRequest {
534609
// The API version assumed by the CO. This is a REQUIRED field.
535610
Version version = 1;
@@ -664,6 +739,7 @@ message NodeServiceCapability {
664739
message RPC {
665740
enum Type {
666741
UNKNOWN = 0;
742+
PUBLISH_UNPUBLISH_DEVICE = 1;
667743
}
668744

669745
Type type = 1;
@@ -1110,6 +1186,111 @@ message Error {
11101186
string error_description = 2;
11111187
}
11121188

1189+
// `NodePublishDevice` specific error.
1190+
message NodePublishDeviceError {
1191+
enum NodePublishDeviceErrorCode {
1192+
// Default value for backwards compatibility. SHOULD NOT be
1193+
// returned by Plugins. However, if a Plugin returns a
1194+
// `NodePublishDeviceErrorCode` code that an older CSI
1195+
// client is not aware of, the client will see this code (the
1196+
// default fallback).
1197+
//
1198+
// Recovery behavior: Caller SHOULD consider updating CSI client
1199+
// to match Plugin CSI version.
1200+
UNKNOWN = 0;
1201+
1202+
// Indicates that there is a already an operation pending for the
1203+
// specified volume. In general the Cluster Orchestrator (CO) is
1204+
// responsible for ensuring that there is no more than one call
1205+
// “in-flight” per volume at a given time. However, in some
1206+
// circumstances, the CO MAY lose state (for example when the CO
1207+
// crashes and restarts), and MAY issue multiple calls
1208+
// simultaneously for the same volume. The Plugin, SHOULD handle
1209+
// this as gracefully as possible, and MAY return this error code
1210+
// to reject secondary calls.
1211+
//
1212+
// Recovery behavior: Caller SHOULD ensure that there are no other
1213+
// calls pending for the specified volume, and then retry with
1214+
// exponential back off.
1215+
OPERATION_PENDING_FOR_VOLUME = 1;
1216+
1217+
// Indicates that a volume corresponding to the specified
1218+
// volume ID does not exist.
1219+
//
1220+
// Recovery behavior: Caller SHOULD verify that the volume ID
1221+
// is correct and that the volume is accessible and has not been
1222+
// deleted before retrying with exponential back off.
1223+
VOLUME_DOES_NOT_EXIST = 2;
1224+
1225+
UNSUPPORTED_MOUNT_FLAGS = 3;
1226+
UNSUPPORTED_VOLUME_TYPE = 4;
1227+
UNSUPPORTED_FS_TYPE = 5;
1228+
MOUNT_ERROR = 6;
1229+
1230+
// Indicates that the specified volume ID is not allowed or
1231+
// understood by the Plugin. More human-readable information MAY
1232+
// be provided in the `error_description` field.
1233+
//
1234+
// Recovery behavior: Caller MUST fix the volume ID before
1235+
// retrying.
1236+
INVALID_VOLUME_ID = 7;
1237+
}
1238+
1239+
NodePublishDeviceErrorCode error_code = 1;
1240+
string error_description = 2;
1241+
}
1242+
1243+
// `NodeUnpublishDevice` specific error.
1244+
message NodeUnpublishDeviceError {
1245+
enum NodeUnpublishDeviceErrorCode {
1246+
// Default value for backwards compatibility. SHOULD NOT be
1247+
// returned by Plugins. However, if a Plugin returns a
1248+
// `NodeUnpublishDeviceErrorCode` code that an older CSI
1249+
// client is not aware of, the client will see this code (the
1250+
// default fallback).
1251+
//
1252+
// Recovery behavior: Caller SHOULD consider updating CSI client
1253+
// to match Plugin CSI version.
1254+
UNKNOWN = 0;
1255+
1256+
// Indicates that there is a already an operation pending for the
1257+
// specified volume. In general the Cluster Orchestrator (CO) is
1258+
// responsible for ensuring that there is no more than one call
1259+
// “in-flight” per volume at a given time. However, in some
1260+
// circumstances, the CO MAY lose state (for example when the CO
1261+
// crashes and restarts), and MAY issue multiple calls
1262+
// simultaneously for the same volume. The Plugin, SHOULD handle
1263+
// this as gracefully as possible, and MAY return this error code
1264+
// to reject secondary calls.
1265+
//
1266+
// Recovery behavior: Caller SHOULD ensure that there are no other
1267+
// calls pending for the specified volume, and then retry with
1268+
// exponential back off.
1269+
OPERATION_PENDING_FOR_VOLUME = 1;
1270+
1271+
// Indicates that a volume corresponding to the specified
1272+
// volume ID does not exist.
1273+
//
1274+
// Recovery behavior: Caller SHOULD verify that the volume ID
1275+
// is correct and that the volume is accessible and has not been
1276+
// deleted before retrying with exponential back off.
1277+
VOLUME_DOES_NOT_EXIST = 2;
1278+
1279+
UNMOUNT_ERROR = 3;
1280+
1281+
// Indicates that the specified volume ID is not allowed or
1282+
// understood by the Plugin. More human-readable information MAY
1283+
// be provided in the `error_description` field.
1284+
//
1285+
// Recovery behavior: Caller MUST fix the volume ID before
1286+
// retrying.
1287+
INVALID_VOLUME_ID = 4;
1288+
}
1289+
1290+
NodeUnpublishDeviceErrorCode error_code = 1;
1291+
string error_description = 2;
1292+
}
1293+
11131294
// `NodePublishVolume` specific error.
11141295
message NodePublishVolumeError {
11151296
enum NodePublishVolumeErrorCode {

0 commit comments

Comments
 (0)