From 9308b80ed2658760e33963b16e1e7ccdc1daccd7 Mon Sep 17 00:00:00 2001 From: Diwakar Sharma Date: Fri, 8 Mar 2024 10:46:46 +0000 Subject: [PATCH] feat(volume/resize): don't allow volume resize for snapshot restore volume Signed-off-by: Diwakar Sharma --- .../agents/src/bin/core/volume/operations.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/control-plane/agents/src/bin/core/volume/operations.rs b/control-plane/agents/src/bin/core/volume/operations.rs index f7f097847..9758c6b21 100644 --- a/control-plane/agents/src/bin/core/volume/operations.rs +++ b/control-plane/agents/src/bin/core/volume/operations.rs @@ -191,11 +191,16 @@ impl ResourceResize for OperationGuardArc { let spec = self.as_ref().clone(); let state = registry.volume_state(&request.uuid).await?; - // Pre-check - Don't allow resize if the volume has snapshots. + // Pre-check - Don't allow resize if the volume has snapshots, or the volume is + // a snapshot restore volume. // NOTE: This is temporary till the fix for handling this in spdk is done. - if !registry.specs().snapshots_by_vol(self.uuid()).is_empty() { + if !registry.specs().snapshots_by_vol(self.uuid()).is_empty() + || spec.content_source.is_some() + { return Err(SvcError::Internal { - details: "Volume can't be resized while it has snapshots".into(), + details: + "Volume can't be resized while it has snapshots, or it's a snapshot restore" + .into(), }); } // If the volume is published, then we need to resize nexus also along with replicas.