Repository navigation
Closed
Labels
known issueTo include in customer documentation and trainingvirtualizationPropolis Integration & VM Management
Milestone
Description
There are various cases where the control plane might discover that Instances that we thought were running are, in fact, not. Examples (from concrete to speculative):
- when Nexus is notified by Sled Agent (in turn notified from Propolis) that a guest is no longer running (because it was stopped from inside the guest)
- when a sled reboots, its instances are all gone and this process needs to be applied to each of them (this is restart customer Instances after sled reboot #3633)
- when we implement support for (ungraceful) sled removal, we'll need to apply this to all of the instances that we thought were on the system that's been removed
- we probably want some periodic task that asks Sled Agent what instances it's running and compares that to what we think it should be running
- we may want a periodic task that monitors sleds and, if we find that they seem to be unexpectedly not responding, takes steps to make sure that they're offline (i.e., power cycles them via Ignition) and then applies this process for any instances on them
Relaying some notes from @gjcolombo (my apologies where I've got these details wrong):
- this code path exists today where we handle the first case above (where Nexus handles a message from Sled Agent saying the instance is no longer running)
- this code path has some issues and is not well factored use in other contexts like we need here
- all of this would be reworked by Tracking: Instance Lifecycle Overhaul #3742
- the "cleanup" referred to here includes: foreign key from instance to vmm table needs to be reaped; networking state needs to be cleaned up; provisioning counters and sled resources need to be cleaned up; etc.
- the "next steps" referred to here include: looking at some per-instance "fault discipline" (currently the "boot_on_fault" boolean) to determine if we should start the instance running again somewhere else and, if so, doing that
We may view this issue as a dup of #3742 but I wanted to file this separate ticket to reflect more precisely what's needed for sled removal. The implementation may well just be #3742.
Metadata
Metadata
Labels
known issueTo include in customer documentation and trainingvirtualizationPropolis Integration & VM Management
Activity
gjcolombo commentedon Jan 23, 2024
#4226 is also tangentially related. Today Nexus uses the "Failed" instance state to mean, more or less, "something went wrong during some operation on this instance," and the only recovery action we support is deleting the instance (see #2825). #4226 proposes distinguishing between different values of "something" so that we can recover appropriately: transient error conditions might resolve on retry, but if a sled reports that a VMM is definitely gone then the error is permanent.
4226 could possibly be resolved without handling cases like "the operator says this sled is gone, so all the living VMMs there should immediately be marked as gone," so these issues aren't duplicates. But I think they're all dancing around a single concept--Nexus should have an idea of a VMM's "health," which I think could start out along these lines:
Then there should be some code path that periodically deals with "definitely-dead" VMMs that are still pointed to by their Instances, as discussed above, and the "rudely remove a sled" API would just need to mark the target VMMs as "definitely stopped, did not gracefully shut down."
sled agent: index running VMMs by VMM ID, not instance ID (#6429)
hawkw commentedon Sep 2, 2024
PR #6455 will move instances to
InstanceState::Failedwhen the sled-agent believes that the instance's active VMM is no longer present. This happens when a sled reboots (as well as if the instance's VMM crashes). That PR changes the semantics of theFailedstate so thatFailedinstances are now eligible to be restarted or deleted, and ensures that the sled resources and virtual provisioning resources allocated to such instances are cleaned up by aninstance-updatesaga before the instance is transitioned toFailed.Transitions to
Failedare triggered by both API requests that attempt to change the state of an instance that's no longer there, and theinstance-watcherbackground task added in #5611 when a sled-agent definitively indicates that it no longer knows about the instance's VMM. So, that checks offWe don't currently transition instances to
Failedin the face of communication errors, as described inas that kind of health checking is a bit more complex, but we could certainly start transitioning instances to
Failedonce we start doing sled-level health checks.Once #6455 is merged, PR #6499 refactors
instance.boot_on_faultinto an enum to allow more expressive auto-restart policies, and #6503 adds a background task for automatically restartingFailedinstances if the auto-restart policy allows it. By default, instances are not currently allowed to be automatically restarted; we'll probably want to wire up a way for users to specify this policy when creating instances.[nexus] handle sled-agent errors as described in RFD 486 (#6455)
davepacheco commentedon Sep 3, 2024
@hawkw That all makes sense. So in terms of the main ask in this ticket: when Reconfigurator expunges a sled and wants to clean up all those instances, what do we do? Would it be enough to activate the instance-watcher task? Would that task correctly handle instances whose database state shows a vmm on a sled that is now expunged?
hawkw commentedon Sep 3, 2024
The instance-watcher task does not presently handle that case. At present, it only marks instances as
Failedwhen the sled-agent for that instance responds with an error indicating that it definitively does not believe it's supposed to have that instance (which is what would happen if the sled rebooted, or if the Propolis went away).Right now, the query that the
instance-watchertask uses to find sleds to health-check selects onlyInServicesleds:omicron/nexus/db-queries/src/db/datastore/instance.rs
Line 823 in a77c31b
However, we could pretty easily remove that, and we could change the task to check the state of the sled before starting a health check, and if the sled has been expunged, just go ahead and mark all its VMMs as
Failedinstead of actually sending a HTTP request to the sled-agent. I'd be happy to go do that!davepacheco commentedon Sep 24, 2024
Whether or not we consider this done, I think the pieces we were tracking for add/remove sled are done (#6519, #6503) so I'm removing this from the Reconfigurator board.
hawkw commentedon Sep 24, 2024
I think that this is done, modulo:
But, that seems like a substantial enough chunk of work that it might be better considered its own project (and perhaps deserves an RFD?). As far as explicit expungement, I'm for marking this one as done and moving forward potential automated reboots of disappeared sleds into its own thing.
hawkw commentedon Sep 26, 2024
I'm gonna close this out, I think that that detecting unresponsive sleds seems like it'll be part of the ongoing FMA/health-checking work.