Skip to content

Commit 59b4f8d

Browse files
committed
NodePublishDevice
This patch handles issue #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 d68da7a commit 59b4f8d

File tree

3 files changed

+1344
-250
lines changed

3 files changed

+1344
-250
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

@@ -344,7 +350,8 @@ message ControllerPublishVolumeRequest {
344350
message ControllerPublishVolumeResponse {
345351
message Result {
346352
// The SP specific information that will be passed to the Plugin in
347-
// the subsequent `NodePublishVolume` call for the given volume.
353+
// the subsequent `NodePublishDevice` and `NodePublishVolume` calls
354+
// for the given volume.
348355
// This information is opaque to the CO. This field is OPTIONAL.
349356
PublishVolumeInfo publish_volume_info = 1;
350357
}
@@ -561,6 +568,74 @@ message ControllerServiceCapability {
561568
}
562569
////////
563570
////////
571+
message NodePublishDeviceRequest {
572+
// The API version assumed by the CO. This is a REQUIRED field.
573+
Version version = 1;
574+
575+
// The ID of the volume to publish. This field is REQUIRED.
576+
string volume_id = 2;
577+
578+
// The CO SHALL set this field to the value returned by
579+
// `ControllerPublishVolume` if the corresponding Controller Plugin
580+
// has `PUBLISH_UNPUBLISH_VOLUME` controller capability, and SHALL be
581+
// left unset if the corresponding Controller Plugin does not have
582+
// this capability. This is an OPTIONAL field.
583+
PublishVolumeInfo publish_volume_info = 3;
584+
585+
// The path to which the volume will be published. It MUST be an
586+
// absolute path in the root filesystem of the process serving this
587+
// request. The CO SHALL ensure uniqueness of mount_path per volume.
588+
// This is a REQUIRED field.
589+
string mount_path = 4;
590+
591+
// The capability of the volume the CO expects the volume to have.
592+
// This is a REQUIRED field.
593+
VolumeCapability volume_capability = 5;
594+
595+
// End user credentials used to authenticate/authorize node publish
596+
// request. This field is OPTIONAL.
597+
Credentials user_credentials = 6;
598+
}
599+
600+
message NodePublishDeviceResponse {
601+
message Result {}
602+
603+
// One of the following fields MUST be specified.
604+
oneof reply {
605+
Result result = 1;
606+
Error error = 2;
607+
}
608+
}
609+
////////
610+
////////
611+
message NodeUnpublishDeviceRequest {
612+
// The API version assumed by the CO. This is a REQUIRED field.
613+
Version version = 1;
614+
615+
// The ID of the volume. This field is REQUIRED.
616+
string volume_id = 2;
617+
618+
// The path at which the volume was published. It MUST be an absolute
619+
// path in the root filesystem of the process serving this request.
620+
// This is a REQUIRED field.
621+
string mount_path = 3;
622+
623+
// End user credentials used to authenticate/authorize node unpublish
624+
// request. This field is OPTIONAL.
625+
Credentials user_credentials = 4;
626+
}
627+
628+
message NodeUnpublishDeviceResponse {
629+
message Result {}
630+
631+
// One of the following fields MUST be specified.
632+
oneof reply {
633+
Result result = 1;
634+
Error error = 2;
635+
}
636+
}
637+
////////
638+
////////
564639
message NodePublishVolumeRequest {
565640
// The API version assumed by the CO. This is a REQUIRED field.
566641
Version version = 1;
@@ -695,6 +770,7 @@ message NodeServiceCapability {
695770
message RPC {
696771
enum Type {
697772
UNKNOWN = 0;
773+
PUBLISH_UNPUBLISH_DEVICE = 1;
698774
}
699775

700776
Type type = 1;
@@ -1141,6 +1217,111 @@ message Error {
11411217
string error_description = 2;
11421218
}
11431219

1220+
// `NodePublishDevice` specific error.
1221+
message NodePublishDeviceError {
1222+
enum NodePublishDeviceErrorCode {
1223+
// Default value for backwards compatibility. SHOULD NOT be
1224+
// returned by Plugins. However, if a Plugin returns a
1225+
// `NodePublishDeviceErrorCode` code that an older CSI
1226+
// client is not aware of, the client will see this code (the
1227+
// default fallback).
1228+
//
1229+
// Recovery behavior: Caller SHOULD consider updating CSI client
1230+
// to match Plugin CSI version.
1231+
UNKNOWN = 0;
1232+
1233+
// Indicates that there is a already an operation pending for the
1234+
// specified volume. In general the Cluster Orchestrator (CO) is
1235+
// responsible for ensuring that there is no more than one call
1236+
// “in-flight” per volume at a given time. However, in some
1237+
// circumstances, the CO MAY lose state (for example when the CO
1238+
// crashes and restarts), and MAY issue multiple calls
1239+
// simultaneously for the same volume. The Plugin, SHOULD handle
1240+
// this as gracefully as possible, and MAY return this error code
1241+
// to reject secondary calls.
1242+
//
1243+
// Recovery behavior: Caller SHOULD ensure that there are no other
1244+
// calls pending for the specified volume, and then retry with
1245+
// exponential back off.
1246+
OPERATION_PENDING_FOR_VOLUME = 1;
1247+
1248+
// Indicates that a volume corresponding to the specified
1249+
// volume ID does not exist.
1250+
//
1251+
// Recovery behavior: Caller SHOULD verify that the volume ID
1252+
// is correct and that the volume is accessible and has not been
1253+
// deleted before retrying with exponential back off.
1254+
VOLUME_DOES_NOT_EXIST = 2;
1255+
1256+
UNSUPPORTED_MOUNT_FLAGS = 3;
1257+
UNSUPPORTED_VOLUME_TYPE = 4;
1258+
UNSUPPORTED_FS_TYPE = 5;
1259+
MOUNT_ERROR = 6;
1260+
1261+
// Indicates that the specified volume ID is not allowed or
1262+
// understood by the Plugin. More human-readable information MAY
1263+
// be provided in the `error_description` field.
1264+
//
1265+
// Recovery behavior: Caller MUST fix the volume ID before
1266+
// retrying.
1267+
INVALID_VOLUME_ID = 7;
1268+
}
1269+
1270+
NodePublishDeviceErrorCode error_code = 1;
1271+
string error_description = 2;
1272+
}
1273+
1274+
// `NodeUnpublishDevice` specific error.
1275+
message NodeUnpublishDeviceError {
1276+
enum NodeUnpublishDeviceErrorCode {
1277+
// Default value for backwards compatibility. SHOULD NOT be
1278+
// returned by Plugins. However, if a Plugin returns a
1279+
// `NodeUnpublishDeviceErrorCode` code that an older CSI
1280+
// client is not aware of, the client will see this code (the
1281+
// default fallback).
1282+
//
1283+
// Recovery behavior: Caller SHOULD consider updating CSI client
1284+
// to match Plugin CSI version.
1285+
UNKNOWN = 0;
1286+
1287+
// Indicates that there is a already an operation pending for the
1288+
// specified volume. In general the Cluster Orchestrator (CO) is
1289+
// responsible for ensuring that there is no more than one call
1290+
// “in-flight” per volume at a given time. However, in some
1291+
// circumstances, the CO MAY lose state (for example when the CO
1292+
// crashes and restarts), and MAY issue multiple calls
1293+
// simultaneously for the same volume. The Plugin, SHOULD handle
1294+
// this as gracefully as possible, and MAY return this error code
1295+
// to reject secondary calls.
1296+
//
1297+
// Recovery behavior: Caller SHOULD ensure that there are no other
1298+
// calls pending for the specified volume, and then retry with
1299+
// exponential back off.
1300+
OPERATION_PENDING_FOR_VOLUME = 1;
1301+
1302+
// Indicates that a volume corresponding to the specified
1303+
// volume ID does not exist.
1304+
//
1305+
// Recovery behavior: Caller SHOULD verify that the volume ID
1306+
// is correct and that the volume is accessible and has not been
1307+
// deleted before retrying with exponential back off.
1308+
VOLUME_DOES_NOT_EXIST = 2;
1309+
1310+
UNMOUNT_ERROR = 3;
1311+
1312+
// Indicates that the specified volume ID is not allowed or
1313+
// understood by the Plugin. More human-readable information MAY
1314+
// be provided in the `error_description` field.
1315+
//
1316+
// Recovery behavior: Caller MUST fix the volume ID before
1317+
// retrying.
1318+
INVALID_VOLUME_ID = 4;
1319+
}
1320+
1321+
NodeUnpublishDeviceErrorCode error_code = 1;
1322+
string error_description = 2;
1323+
}
1324+
11441325
// `NodePublishVolume` specific error.
11451326
message NodePublishVolumeError {
11461327
enum NodePublishVolumeErrorCode {

0 commit comments

Comments
 (0)