fix: create_vm() detects ERROR status, fails fast with fault detail - #24
Draft
Koan-Bot wants to merge 1 commit into
Draft
fix: create_vm() detects ERROR status, fails fast with fault detail#24Koan-Bot wants to merge 1 commit into
Koan-Bot wants to merge 1 commit into
Conversation
When a VM transitions to ERROR (scheduler failure, image issue, quota exhaustion, etc.) create_vm() would keep polling for ACTIVE until the configured timeout — typically 5 minutes — then die with a generic "never came back as active" message. The fault data already attached to the server response was discarded. Detect ERROR (case-insensitive) inside the loop and die immediately with the fault code/message when present, so callers learn about provisioning failures fast and with diagnostic detail. Adds t/create-vm-error-status.t covering: fast-fail behaviour, lower-case status, and the no-fault-structure edge case.
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Detect
ERRORstatus while polling a newly created VM and die immediately with thefaultcode/message from the server response, instead of waiting out the full timeout.Why
When OpenStack fails to provision (no scheduling host, image/quota issue, network problem) the server transitions to
ERRORand the response includes afaultobject explaining what went wrong. The current loop keeps polling forACTIVEregardless — burning the fullcreate_max_timeout(default 5 min) — then dies with a genericnever came back as activemessage that throws away the fault info OpenStack already gave us.This is the kind of bug that quietly costs operators hours during outages.
How
MetaAPI.pm::create_vm, lowercase the status once and branch onactive/errorinstead of onlyactive.error, build a die message that includes$server_uid,fault->{code}, andfault->{message}when present — gracefully degrading when there is no fault hash.Testing
t/create-vm-error-status.twith 4 subtests:erroris also caught.faulthash still dies cleanly.prove -l t/— 27 tests across 7 files.🤖 Generated with Claude Code