From 3cf1e63876843bef02700d07b724cf79ee943a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jules=20Cast=C3=A9ran?= Date: Fri, 27 Dec 2024 20:01:48 +0100 Subject: [PATCH] fix(instance): wait for volumes to be available before deletion (#4388) --- internal/namespaces/instance/v1/custom_server_delete.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/namespaces/instance/v1/custom_server_delete.go b/internal/namespaces/instance/v1/custom_server_delete.go index 377d752c6..32f88e487 100644 --- a/internal/namespaces/instance/v1/custom_server_delete.go +++ b/internal/namespaces/instance/v1/custom_server_delete.go @@ -234,9 +234,11 @@ func serverDeleteVolume(volume *instance.VolumeServer, instanceAPI *instance.API var err error if volume.VolumeType == instance.VolumeServerVolumeTypeSbsVolume { + volumeAvailable := block.VolumeStatusAvailable _, err = blockAPI.WaitForVolumeAndReferences(&block.WaitForVolumeAndReferencesRequest{ - Zone: volume.Zone, - VolumeID: volume.ID, + Zone: volume.Zone, + VolumeID: volume.ID, + VolumeTerminalStatus: &volumeAvailable, }) if err != nil { return errorDeletingResource(err)