Skip to content

Commit

Permalink
fix(snapshot): scale volume with snapshot can go for replica rebuild
Browse files Browse the repository at this point in the history
Signed-off-by: Hrudaya <[email protected]>
  • Loading branch information
hrudaya21 committed May 15, 2024
1 parent 0167bc3 commit 0f72cdd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
4 changes: 1 addition & 3 deletions control-plane/agents/src/bin/core/volume/specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1034,9 +1034,7 @@ impl SpecOperationsHelper for VolumeSpec {
}

VolumeOperation::SetReplica(replica_count) => {
if self.has_snapshots() {
Err(SvcError::NReplSnapshotNotAllowed {})
} else if *replica_count == self.num_replicas {
if *replica_count == self.num_replicas {
Err(SvcError::ReplicaCountAchieved {
id: self.uuid_str(),
count: self.num_replicas,
Expand Down
18 changes: 0 additions & 18 deletions control-plane/agents/src/common/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,6 @@ pub enum SvcError {
request: String,
source: tonic::Status,
},
#[snafu(display("Snapshots for multi-replica volumes are not allowed"))]
NReplSnapshotNotAllowed {},
#[snafu(display(
"Cannot create a multi-replica volume from a snapshot of a single-replica volume"
))]
NReplSnapshotCloneCreationNotAllowed {},
#[snafu(display("Replica's {} snapshot was unexpectedly skipped", replica))]
ReplicaSnapSkipped { replica: String },
#[snafu(display("Replica's {} snapshot was unexpectedly not taken", replica))]
Expand Down Expand Up @@ -951,18 +945,6 @@ impl From<SvcError> for ReplyError {
source,
extra,
},
SvcError::NReplSnapshotNotAllowed {} => ReplyError {
kind: ReplyErrorKind::InvalidArgument,
resource: ResourceKind::VolumeSnapshot,
source,
extra,
},
SvcError::NReplSnapshotCloneCreationNotAllowed {} => ReplyError {
kind: ReplyErrorKind::InvalidArgument,
resource: ResourceKind::VolumeSnapshotClone,
source,
extra,
},
SvcError::ReplicaSnapSkipped { .. } => ReplyError {
kind: ReplyErrorKind::Aborted,
resource: ResourceKind::VolumeSnapshot,
Expand Down

0 comments on commit 0f72cdd

Please sign in to comment.