You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
503 error when snapshotting disks attached to stopped instances #3289
(Once I started up the VM, I was able to create snapshots for both of the disks attached to this vm on rack2.)
If snapshot is prohibited on disks attached to stopped instances, we should probably prevent the snapshot action with a more explicit error. A 503 response would imply that the service is only temporarily unavailable and user may retry the action.
If snapshots should be allowed on disks, then it is a functional issue.
info!(log,"setting state of {} to maintenance", params.disk_id);
osagactx
.datastore()
.disk_update_runtime(
&opctx,
&authz_disk,
&db_disk.runtime().maintenance(),
)
.await
.map_err(ActionError::action_failed)?;
}
external::DiskState::Finalizing => {
// This saga is a sub-saga of the finalize saga if the user has
// specified an optional snapshot should be taken. No state change
// is required.
info!(log,"disk {} in state finalizing", params.disk_id);
}
_ => {
// Return a 503 indicating that the user should retry
returnErr(ActionError::action_failed(
Error::ServiceUnavailable{
internal_message:format!(
"disk is in state {:?}",
db_disk.state(),
),
},
));
}
}
The disk state here is expected to be Detached, but if the disk is attached to a stopped instance this match will return 503. The part of Nexus that checks whether or not the Pantry should be used to take a snapshot says to use the Pantry if the instance is stopped:
// If there *may* be a propolis running, then fail: we can't
// know if that propolis has activated the Volume or not, or if
// it's in the process of deactivating.
_ => {
returnErr(
Error::invalid_request(
&format!("cannot snapshot attached disk for instance in state {}", instance_state)
)
);
}
There needs to be more work here: at the minimum, the disk's state changes to Maintenance as part of this saga, and this has to work with (read: block) the instance from starting. This may not be a candidate for FCS though, due to the workaround of starting the instance existing?
Thanks for root-causing/sizing this. Let's re-target this to MVP give the effort and impact involved. I'll document this known issue in the release notes because users will likely want to create clean snapshots on stopped instances (so that things such as temporary files locks created by running applications won't be part of the snapshot).
Want to note that a customer indicated that they would like to see a fix for this issue sooner for the same reason I mentioned above (i.e. their best practice is to create snapshots on stopped instances).
Activity
jmpesp commentedon Jun 5, 2023
In this case, it's a functional issue. Taking a snapshot of an attached disk is allowed.
jmpesp commentedon Jul 7, 2023
Here's the bug in the snapshot create saga:
omicron/nexus/src/app/sagas/snapshot_create.rs
Lines 820 to 853 in c2de480
The disk state here is expected to be Detached, but if the disk is attached to a stopped instance this match will return 503. The part of Nexus that checks whether or not the Pantry should be used to take a snapshot says to use the Pantry if the instance is stopped:
omicron/nexus/src/app/snapshot.rs
Lines 106 to 126 in c2de480
There needs to be more work here: at the minimum, the disk's state changes to Maintenance as part of this saga, and this has to work with (read: block) the instance from starting. This may not be a candidate for FCS though, due to the workaround of starting the instance existing?
askfongjojo commentedon Jul 8, 2023
Thanks for root-causing/sizing this. Let's re-target this to MVP give the effort and impact involved. I'll document this known issue in the release notes because users will likely want to create clean snapshots on stopped instances (so that things such as temporary files locks created by running applications won't be part of the snapshot).
askfongjojo commentedon Jul 25, 2023
Want to note that a customer indicated that they would like to see a fix for this issue sooner for the same reason I mentioned above (i.e. their best practice is to create snapshots on stopped instances).
2 remaining items
Prevent unintentional Upstairs takeovers
Prevent unintentional Upstairs takeovers (#5221)