Skip to content

fix: wait for volume to become available before cleanup deletion#150

Open
Autherain wants to merge 1 commit intohashicorp:mainfrom
Autherain:fix/wait-for-volume-before-cleanup
Open

fix: wait for volume to become available before cleanup deletion#150
Autherain wants to merge 1 commit intohashicorp:mainfrom
Autherain:fix/wait-for-volume-before-cleanup

Conversation

@Autherain
Copy link
Copy Markdown

Fixes #123

Problem

When use_blockstorage_volume is enabled, the Cleanup() method in StepCreateVolume` attempts to delete the volume immediately after the has been created. However, Cinder may still be detaching the (status "uploading"), causing deletion to fail with a 400 error:

  Volume status must be available or error or error_restoring or or error_managing and must not be migrating, belong to a group, have snapshots, awaiting a transfer, be disassociated from snapshots after volume transfer.

This leaves orphaned volumes that require manual cleanup.

Fix

Added a call to the existing WaitForVolume() function before attempting deletion in Cleanup(). This polls until the volume reaches "available" or "error" status, which is consistent with how Run() already waits after volume creation.

If the wait fails, deletion is still attempted as a best-effort
fallback.

Testing

  • go build ./... passes
  • go test ./builder/openstack/... passes
  • go fmt applied

@Autherain Autherain requested a review from a team as a code owner March 31, 2026 16:13
@hashicorp-cla-app
Copy link
Copy Markdown

hashicorp-cla-app bot commented Mar 31, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to build image when using root block storage volume

1 participant