Skip to content

Commit a8448c4

Browse files
committed
Add Topology for Snapshot
This PR adds topology requirements for snapshots.
1 parent 7c6a627 commit a8448c4

File tree

3 files changed

+703
-500
lines changed

3 files changed

+703
-500
lines changed

csi.proto

Lines changed: 135 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,21 @@ message PluginCapability {
130130
// as specific RPCs as indicated by ControllerGetCapabilities.
131131
CONTROLLER_SERVICE = 1;
132132

133-
// ACCESSIBILITY_CONSTRAINTS indicates that the volumes for this
134-
// plugin may not be equally accessible by all nodes in the
133+
// VOLUME_ACCESSIBILITY_CONSTRAINTS indicates that the volumes for
134+
// this plugin may not be equally accessible by all nodes in the
135135
// cluster. The CO MUST use the topology information returned by
136136
// CreateVolumeRequest along with the topology information
137137
// returned by NodeGetInfo to ensure that a given volume is
138138
// accessible from a given node when scheduling workloads.
139-
ACCESSIBILITY_CONSTRAINTS = 2;
139+
VOLUME_ACCESSIBILITY_CONSTRAINTS = 2;
140+
141+
// SNAPSHOT_ACCESSIBILITY_CONSTRAINTS indicates that the snapshots
142+
// for this plugin may not be equally accessible by all nodes in
143+
// the cluster. The CO MUST use the topology information returned
144+
// by CreateSnapshotRequest along with the topology information
145+
// returned by NodeGetInfo to ensure that a given snapshot is
146+
// accessible from a given node when scheduling workloads.
147+
SNAPSHOT_ACCESSIBILITY_CONSTRAINTS = 3;
140148
}
141149
Type type = 1;
142150
}
@@ -231,10 +239,10 @@ message CreateVolumeRequest {
231239
// topological accessibility information supported by the SP.
232240
// This field is OPTIONAL.
233241
// This field SHALL NOT be specified unless the SP has the
234-
// ACCESSIBILITY_CONSTRAINTS plugin capability.
242+
// VOLUME_ACCESSIBILITY_CONSTRAINTS plugin capability.
235243
// If this field is not specified and the SP has the
236-
// ACCESSIBILITY_CONSTRAINTS plugin capability, the SP MAY choose
237-
// where the provisioned volume is accessible from.
244+
// VOLUME_ACCESSIBILITY_CONSTRAINTS plugin capability, the SP MAY
245+
// choose where the provisioned volume is accessible from.
238246
TopologyRequirement accessibility_requirements = 7;
239247
}
240248

@@ -368,7 +376,7 @@ message Volume {
368376
// Specifies where (regions, zones, racks, etc.) the provisioned
369377
// volume is accessible from.
370378
// A plugin that returns this field MUST also set the
371-
// ACCESSIBILITY_CONSTRAINTS plugin capability.
379+
// VOLUME_ACCESSIBILITY_CONSTRAINTS plugin capability.
372380
// An SP MAY specify multiple topologies to indicate the volume is
373381
// accessible from multiple locations.
374382
// COs MAY use this information along with the topology information
@@ -394,99 +402,109 @@ message Volume {
394402
}
395403

396404
message TopologyRequirement {
397-
// Specifies the list of topologies the provisioned volume MUST be
398-
// accessible from.
405+
// Specifies the list of topologies the provisioned volume or
406+
// snapshot MUST be accessible from.
399407
// This field is OPTIONAL. If TopologyRequirement is specified either
400408
// requisite or preferred or both MUST be specified.
401409
//
402-
// If requisite is specified, the provisioned volume MUST be
403-
// accessible from at least one of the requisite topologies.
410+
// If requisite is specified, the provisioned volume or snapshot MUST
411+
// be accessible from at least one of the requisite topologies.
404412
//
405413
// Given
406-
// x = number of topologies provisioned volume is accessible from
414+
// x = number of topologies provisioned volume or snapshot is
415+
// accessible from
407416
// n = number of requisite topologies
408417
// The CO MUST ensure n >= 1. The SP MUST ensure x >= 1
409-
// If x==n, than the SP MUST make the provisioned volume available to
410-
// all topologies from the list of requisite topologies. If it is
411-
// unable to do so, the SP MUST fail the CreateVolume call.
412-
// For example, if a volume should be accessible from a single zone,
413-
// and requisite =
418+
// If x==n, than the SP MUST make the provisioned volume or snapshot
419+
// available to all topologies from the list of requisite topologies.
420+
// If it is unable to do so, the SP MUST fail the CreateVolume or
421+
// CreateSnapshot call. For example, if a volume or snapshot should be
422+
// accessible from a single zone, and
423+
// requisite =
414424
// {"region": "R1", "zone": "Z2"}
415-
// then the provisioned volume MUST be accessible from the "region"
416-
// "R1" and the "zone" "Z2".
417-
// Similarly, if a volume should be accessible from two zones, and
425+
// then the provisioned volume or snapshot MUST be accessible from
426+
// the "region" "R1" and the "zone" "Z2".
427+
// Similarly, if a volume or snapshot should be accessible from two
428+
// zones, and
418429
// requisite =
419430
// {"region": "R1", "zone": "Z2"},
420431
// {"region": "R1", "zone": "Z3"}
421-
// then the provisioned volume MUST be accessible from the "region"
422-
// "R1" and both "zone" "Z2" and "zone" "Z3".
432+
// then the provisioned volume or snapshot MUST be accessible from the
433+
// "region" "R1" and both "zone" "Z2" and "zone" "Z3".
423434
//
424435
// If x<n, than the SP SHALL choose x unique topologies from the list
425436
// of requisite topologies. If it is unable to do so, the SP MUST fail
426-
// the CreateVolume call.
427-
// For example, if a volume should be accessible from a single zone,
437+
// the CreateVolume or CreateSnapshot call.
438+
// For example, if a volume or snapshot should be accessible from a
439+
// single zone,
428440
// and requisite =
429441
// {"region": "R1", "zone": "Z2"},
430442
// {"region": "R1", "zone": "Z3"}
431-
// then the SP may choose to make the provisioned volume available in
432-
// either the "zone" "Z2" or the "zone" "Z3" in the "region" "R1".
433-
// Similarly, if a volume should be accessible from two zones, and
443+
// then the SP may choose to make the provisioned volume or snapshot
444+
// available in either the "zone" "Z2" or the "zone" "Z3" in the
445+
// "region" "R1".
446+
// Similarly, if a volume or snapshot should be accessible from two
447+
// zones, and
434448
// requisite =
435449
// {"region": "R1", "zone": "Z2"},
436450
// {"region": "R1", "zone": "Z3"},
437451
// {"region": "R1", "zone": "Z4"}
438-
// then the provisioned volume MUST be accessible from any combination
439-
// of two unique topologies: e.g. "R1/Z2" and "R1/Z3", or "R1/Z2" and
440-
// "R1/Z4", or "R1/Z3" and "R1/Z4".
452+
// then the provisioned volume or snapshot MUST be accessible from any
453+
// combination of two unique topologies: e.g. "R1/Z2" and "R1/Z3", or
454+
// "R1/Z2" and "R1/Z4", or "R1/Z3" and "R1/Z4".
441455
//
442-
// If x>n, than the SP MUST make the provisioned volume available from
443-
// all topologies from the list of requisite topologies and MAY choose
444-
// the remaining x-n unique topologies from the list of all possible
445-
// topologies. If it is unable to do so, the SP MUST fail the
446-
// CreateVolume call.
447-
// For example, if a volume should be accessible from two zones, and
456+
// If x>n, than the SP MUST make the provisioned volume or snapshot
457+
// available from all topologies from the list of requisite topologies
458+
// and MAY choose the remaining x-n unique topologies from the list of
459+
// all possible topologies. If it is unable to do so, the SP MUST fail
460+
// the CreateVolume or CreateSnapshot call.
461+
// For example, if a volume or snapshot should be accessible from two
462+
// zones, and
448463
// requisite =
449464
// {"region": "R1", "zone": "Z2"}
450-
// then the provisioned volume MUST be accessible from the "region"
451-
// "R1" and the "zone" "Z2" and the SP may select the second zone
452-
// independently, e.g. "R1/Z4".
465+
// then the provisioned volume or snapshot MUST be accessible from the
466+
// "region" "R1" and the "zone" "Z2" and the SP may select the second
467+
// zone independently, e.g. "R1/Z4".
453468
repeated Topology requisite = 1;
454469

455-
// Specifies the list of topologies the CO would prefer the volume to
456-
// be provisioned in.
470+
// Specifies the list of topologies the CO would prefer the volume or
471+
// snapshot to be provisioned in.
457472
//
458473
// This field is OPTIONAL. If TopologyRequirement is specified either
459474
// requisite or preferred or both MUST be specified.
460475
//
461-
// An SP MUST attempt to make the provisioned volume available using
462-
// the preferred topologies in order from first to last.
476+
// An SP MUST attempt to make the provisioned volume or snapshot
477+
// available using the preferred topologies in order from first to
478+
// last.
463479
//
464480
// If requisite is specified, all topologies in preferred list MUST
465481
// also be present in the list of requisite topologies.
466482
//
467-
// If the SP is unable to to make the provisioned volume available
468-
// from any of the preferred topologies, the SP MAY choose a topology
469-
// from the list of requisite topologies.
483+
// If the SP is unable to to make the provisioned volume or snapshot
484+
// available from any of the preferred topologies, the SP MAY choose
485+
// a topology from the list of requisite topologies.
470486
// If the list of requisite topologies is not specified, then the SP
471487
// MAY choose from the list of all possible topologies.
472488
// If the list of requisite topologies is specified and the SP is
473-
// unable to to make the provisioned volume available from any of the
474-
// requisite topologies it MUST fail the CreateVolume call.
489+
// unable to to make the provisioned volume or snapshot available from
490+
// any of the requisite topologies it MUST fail the CreateVolume or
491+
// CreateSnapshot call.
475492
//
476493
// Example 1:
477-
// Given a volume should be accessible from a single zone, and
478-
// requisite =
494+
// Given a volume or snapshot should be accessible from a single zone,
495+
// and requisite =
479496
// {"region": "R1", "zone": "Z2"},
480497
// {"region": "R1", "zone": "Z3"}
481498
// preferred =
482499
// {"region": "R1", "zone": "Z3"}
483500
// then the the SP SHOULD first attempt to make the provisioned volume
484-
// available from "zone" "Z3" in the "region" "R1" and fall back to
485-
// "zone" "Z2" in the "region" "R1" if that is not possible.
501+
// or snapshot available from "zone" "Z3" in the "region" "R1" and
502+
// fall back to "zone" "Z2" in the "region" "R1" if that is not
503+
// possible.
486504
//
487505
// Example 2:
488-
// Given a volume should be accessible from a single zone, and
489-
// requisite =
506+
// Given a volume or snapshot should be accessible from a single zone,
507+
// and requisite =
490508
// {"region": "R1", "zone": "Z2"},
491509
// {"region": "R1", "zone": "Z3"},
492510
// {"region": "R1", "zone": "Z4"},
@@ -495,17 +513,20 @@ message TopologyRequirement {
495513
// {"region": "R1", "zone": "Z4"},
496514
// {"region": "R1", "zone": "Z2"}
497515
// then the the SP SHOULD first attempt to make the provisioned volume
498-
// accessible from "zone" "Z4" in the "region" "R1" and fall back to
499-
// "zone" "Z2" in the "region" "R1" if that is not possible. If that
500-
// is not possible, the SP may choose between either the "zone"
501-
// "Z3" or "Z5" in the "region" "R1".
516+
// or snapshot accessible from "zone" "Z4" in the "region" "R1" and
517+
// fall back to "zone" "Z2" in the "region" "R1" if that is not
518+
// possible. If that is not possible, the SP may choose between either
519+
// the "zone" "Z3" or "Z5" in the "region" "R1".
502520
//
503521
// Example 3:
504-
// Given a volume should be accessible from TWO zones (because an
505-
// opaque parameter in CreateVolumeRequest, for example, specifies
506-
// the volume is accessible from two zones, aka synchronously
507-
// replicated), and
508-
// requisite =
522+
// A volume or snapshot MAY be required to be accessible from TWO
523+
// zones. This MAY be indicated by an opaque parameter in
524+
// CreateVolumeRequest that specifies the volume to be accessible from
525+
// two zones, aka synchronously replicated. While accessibility
526+
// requirements MAY be satisfied by replication, CO MUST NOT assume
527+
// accessibility requires replication.
528+
// Given a volume or snapshot should be accessible from TWO zone,
529+
// and requisite =
509530
// {"region": "R1", "zone": "Z2"},
510531
// {"region": "R1", "zone": "Z3"},
511532
// {"region": "R1", "zone": "Z4"},
@@ -514,10 +535,10 @@ message TopologyRequirement {
514535
// {"region": "R1", "zone": "Z5"},
515536
// {"region": "R1", "zone": "Z3"}
516537
// then the the SP SHOULD first attempt to make the provisioned volume
517-
// accessible from the combination of the two "zones" "Z5" and "Z3" in
518-
// the "region" "R1". If that's not possible, it should fall back to
519-
// a combination of "Z5" and other possibilities from the list of
520-
// requisite. If that's not possible, it should fall back to a
538+
// or snapshot accessible from the combination of the two "zones" "Z5"
539+
// and "Z3" in the "region" "R1". If that's not possible, it should
540+
// fall back to a combination of "Z5" and other possibilities from the
541+
// list of requisite. If that's not possible, it should fall back to a
521542
// combination of "Z3" and other possibilities from the list of
522543
// requisite. If that's not possible, it should fall back to a
523544
// combination of other possibilities from the list of requisite.
@@ -642,7 +663,7 @@ message ValidateVolumeCapabilitiesRequest {
642663
// A caller MAY specify multiple topologies to indicate they believe
643664
// the volume to be accessible from multiple locations.
644665
// This field is OPTIONAL. This field SHALL NOT be set unless the
645-
// plugin advertises the ACCESSIBILITY_CONSTRAINTS capability.
666+
// plugin advertises the VOLUME_ACCESSIBILITY_CONSTRAINTS capability.
646667
repeated Topology accessible_topology = 4;
647668
}
648669

@@ -708,7 +729,7 @@ message GetCapacityRequest {
708729
// `accessible_topology`. This is the same as the
709730
// `accessible_topology` the CO returns in a `CreateVolumeResponse`.
710731
// This field is OPTIONAL. This field SHALL NOT be set unless the
711-
// plugin advertises the ACCESSIBILITY_CONSTRAINTS capability.
732+
// plugin advertises the VOLUME_ACCESSIBILITY_CONSTRAINTS capability.
712733
Topology accessible_topology = 3;
713734
}
714735

@@ -785,6 +806,19 @@ message CreateSnapshotRequest {
785806
// - Specify primary or secondary for replication systems that
786807
// support snapshotting only on primary.
787808
map<string, string> parameters = 4;
809+
810+
// Specifies where (regions, zones, racks, etc.) the provisioned
811+
// snapshot MUST be accessible from.
812+
// An SP SHALL advertise the requirements for topological
813+
// accessibility information in documentation. COs SHALL only specify
814+
// topological accessibility information supported by the SP.
815+
// This field is OPTIONAL.
816+
// This field SHALL NOT be specified unless the SP has the
817+
// SNAPSHOT_ACCESSIBILITY_CONSTRAINTS plugin capability.
818+
// If this field is not specified and the SP has the
819+
// SNAPSHOT_ACCESSIBILITY_CONSTRAINTS plugin capability, the SP MAY
820+
// choose where the provisioned snapshot is accessible from.
821+
TopologyRequirement accessibility_requirements = 5;
788822
}
789823

790824
message CreateSnapshotResponse {
@@ -825,6 +859,33 @@ message Snapshot {
825859

826860
// The status of a snapshot.
827861
SnapshotStatus status = 5;
862+
863+
// Specifies where (regions, zones, racks, etc.) the provisioned
864+
// snapshot is accessible from.
865+
// A plugin that returns this field MUST also set the
866+
// SNAPSHOT_ACCESSIBILITY_CONSTRAINTS plugin capability.
867+
// An SP MAY specify multiple topologies to indicate the snapshot is
868+
// accessible from multiple locations.
869+
// COs MAY use this information along with the topology information
870+
// returned by NodeGetInfo to ensure that a given snapshot is
871+
// accessible from a given node when scheduling workloads.
872+
// This field is OPTIONAL. If it is not specified, the CO MAY assume
873+
// the snapshot is equally accessible from all nodes in the cluster
874+
// and may schedule workloads referencing the snapshot on any
875+
// available node.
876+
//
877+
// Example 1:
878+
// accessible_topology = {"region": "R1", "zone": "Z2"}
879+
// Indicates a snapshot accessible only from the "region" "R1" and the
880+
// "zone" "Z2".
881+
//
882+
// Example 2:
883+
// accessible_topology =
884+
// {"region": "R1", "zone": "Z2"},
885+
// {"region": "R1", "zone": "Z3"}
886+
// Indicates a snapshot accessible from both "zone" "Z2" and "zone"
887+
// "Z3" in the "region" "R1".
888+
repeated Topology accessible_topology = 6;
828889
}
829890

830891
// The status of a snapshot.
@@ -1120,10 +1181,12 @@ message NodeGetInfoResponse {
11201181
// Specifies where (regions, zones, racks, etc.) the node is
11211182
// accessible from.
11221183
// A plugin that returns this field MUST also set the
1123-
// ACCESSIBILITY_CONSTRAINTS plugin capability.
1184+
// VOLUME_ACCESSIBILITY_CONSTRAINTS or
1185+
// SNAPSHOT_ACCESSIBILITY_CONSTRAINTS plugin capability.
11241186
// COs MAY use this information along with the topology information
1125-
// returned in CreateVolumeResponse to ensure that a given volume is
1126-
// accessible from a given node when scheduling workloads.
1187+
// returned in CreateVolumeResponse CreateSnapshotResponse to ensure
1188+
// that a given volume or snapshot is accessible from a given node
1189+
// when scheduling workloads.
11271190
// This field is OPTIONAL. If it is not specified, the CO MAY assume
11281191
// the node is not subject to any topological constraint, and MAY
11291192
// schedule workloads that reference any volume V, such that there are

0 commit comments

Comments
 (0)