Skip to content

Commit 0dbe605

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

File tree

3 files changed

+701
-500
lines changed

3 files changed

+701
-500
lines changed

csi.proto

Lines changed: 134 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,19 @@ 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. While accessibility requirements MAY be satisfied by
526+
// replication, CO MUST NOT assume accessibility requires replication.
527+
// Given a volume or snapshot should be accessible from TWO zones,
528+
// and requisite =
509529
// {"region": "R1", "zone": "Z2"},
510530
// {"region": "R1", "zone": "Z3"},
511531
// {"region": "R1", "zone": "Z4"},
@@ -514,10 +534,10 @@ message TopologyRequirement {
514534
// {"region": "R1", "zone": "Z5"},
515535
// {"region": "R1", "zone": "Z3"}
516536
// 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
537+
// or snapshot accessible from the combination of the two "zones" "Z5"
538+
// and "Z3" in the "region" "R1". If that's not possible, it should
539+
// fall back to a combination of "Z5" and other possibilities from the
540+
// list of requisite. If that's not possible, it should fall back to a
521541
// combination of "Z3" and other possibilities from the list of
522542
// requisite. If that's not possible, it should fall back to a
523543
// combination of other possibilities from the list of requisite.
@@ -642,7 +662,7 @@ message ValidateVolumeCapabilitiesRequest {
642662
// A caller MAY specify multiple topologies to indicate they believe
643663
// the volume to be accessible from multiple locations.
644664
// This field is OPTIONAL. This field SHALL NOT be set unless the
645-
// plugin advertises the ACCESSIBILITY_CONSTRAINTS capability.
665+
// plugin advertises the VOLUME_ACCESSIBILITY_CONSTRAINTS capability.
646666
repeated Topology accessible_topology = 4;
647667
}
648668

@@ -708,7 +728,7 @@ message GetCapacityRequest {
708728
// `accessible_topology`. This is the same as the
709729
// `accessible_topology` the CO returns in a `CreateVolumeResponse`.
710730
// This field is OPTIONAL. This field SHALL NOT be set unless the
711-
// plugin advertises the ACCESSIBILITY_CONSTRAINTS capability.
731+
// plugin advertises the VOLUME_ACCESSIBILITY_CONSTRAINTS capability.
712732
Topology accessible_topology = 3;
713733
}
714734

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

790823
message CreateSnapshotResponse {
@@ -825,6 +858,33 @@ message Snapshot {
825858

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

830890
// The status of a snapshot.
@@ -1120,10 +1180,12 @@ message NodeGetInfoResponse {
11201180
// Specifies where (regions, zones, racks, etc.) the node is
11211181
// accessible from.
11221182
// A plugin that returns this field MUST also set the
1123-
// ACCESSIBILITY_CONSTRAINTS plugin capability.
1183+
// VOLUME_ACCESSIBILITY_CONSTRAINTS or
1184+
// SNAPSHOT_ACCESSIBILITY_CONSTRAINTS plugin capability.
11241185
// 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.
1186+
// returned in CreateVolumeResponse CreateSnapshotResponse to ensure
1187+
// that a given volume or snapshot is accessible from a given node
1188+
// when scheduling workloads.
11271189
// This field is OPTIONAL. If it is not specified, the CO MAY assume
11281190
// the node is not subject to any topological constraint, and MAY
11291191
// schedule workloads that reference any volume V, such that there are

0 commit comments

Comments
 (0)