oxidecomputer / oxidecomputer/omicron

Want better error on refusal to snapshot disk attached to stopped instance

Open
#5,108 5 comments 0 reactions 0 assignees View on GitHub

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.

https://github.com/oxidecomputer/omicron/blob/915276d47096a9ce076453eb75aaa9de29477e80/nexus/src/app/sagas/snapshot_create.rs#L841-L851

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.

https://github.com/oxidecomputer/omicron/blob/915276d47096a9ce076453eb75aaa9de29477e80/nexus/src/app/snapshot.rs#L110-L129

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.