oxidecomputer / oxidecomputer/omicron
Want better error on refusal to snapshot disk attached to stopped instance
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
I tried to create a snapshot of a disk attached to a stopped instance. This is not allowed, but the 503 response surprised me — I would expect a 400 with a more helpful message.
{
"request_id": "f14e26d3-f122-4f12-b284-daf99c2386c3",
"error_code": "ServiceNotAvailable",
"message": "Service Unavailable"
}
I believe the error comes from here.
From the Nexus log:
error_message_external = Service Unavailable
error_message_internal = saga ACTION error at node "disk_generation_number": disk is in state DiskState(Attached(33e6d4a4-6cc7-440f-8a9f-152d94136191))
Something odd might be going on, though, because in theory we are checking in the instance state before we even run the saga and giving precisely the 400 I would expect. Or maybe the problem is that we're hitting the None arm of the match and therefore not getting an error? I'll need to look into this further.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with nexus/src/app/sagas/snapshot_create.rs around lines 841-851 and nexus/src/app/snapshot.rs around lines 110-129. Reproduce the snapshot request for a disk attached to a stopped instance, then trace the instance-state check and the None match arm against the logged saga error. Done means the request returns HTTP 400 with a helpful error instead of 503.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100