Skip to content

Commit 69da5d6

Browse files
authored
sled agent: don't special-case vmm-not-present handling for requests to stop (#6698)
When sled agent receives a request to stop a VMM that's not in the agent's VMM table, return `NoSuchVmm` instead of succeeding. This allows users manually to recover an instance that was Running prior to a sled reboot but hasn't yet been moved to Failed by the instance watcher. Tested manually as follows: 1. Modify sled agent's VMM worker loop so that it doesn't publish VMM state before exiting; this is needed so that manually unregistering an instance from a sled doesn't cause it to go to Stopped 2. Launch a dev cluster with both (1) and the change in this PR. 3. Start an instance, then send an HTTP DELETE to sled agent's internal API to forcibly unregister the VMM. 4. Observe that the instance remains Running in the console. 5. Stop the instance; observe that the "not found, going to Failed" message is displayed and that the instance then goes to Failed. Fixes #4511.
1 parent c727c3f commit 69da5d6

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

sled-agent/src/instance_manager.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -650,24 +650,8 @@ impl InstanceManagerRunner {
650650
target: VmmStateRequested,
651651
) -> Result<(), Error> {
652652
let Some(instance) = self.get_propolis(propolis_id) else {
653-
match target {
654-
// If the instance isn't registered, then by definition it
655-
// isn't running here. Allow requests to stop or destroy the
656-
// instance to succeed to provide idempotency. This has to
657-
// be handled here (that is, on the "instance not found"
658-
// path) to handle the case where a stop request arrived,
659-
// Propolis handled it, sled agent unregistered the
660-
// instance, and only then did a second stop request
661-
// arrive.
662-
VmmStateRequested::Stopped => {
663-
tx.send(Ok(VmmPutStateResponse { updated_runtime: None }))
664-
.map_err(|_| Error::FailedSendClientClosed)?;
665-
}
666-
_ => {
667-
tx.send(Err(Error::NoSuchVmm(propolis_id)))
668-
.map_err(|_| Error::FailedSendClientClosed)?;
669-
}
670-
}
653+
tx.send(Err(Error::NoSuchVmm(propolis_id)))
654+
.map_err(|_| Error::FailedSendClientClosed)?;
671655
return Ok(());
672656
};
673657
instance.put_state(tx, target).await?;

0 commit comments

Comments
 (0)