From 0930cf281d1a71584ca9d07f42789c3bf1b96d7a Mon Sep 17 00:00:00 2001 From: Jules Casteran Date: Fri, 27 Dec 2024 17:48:05 +0100 Subject: [PATCH] fix(instance): wait for volumes to be available before deletion --- 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)