Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restart customer Instances after sled reboot #3633

Closed
davepacheco opened this issue Jul 14, 2023 · 6 comments
Closed

restart customer Instances after sled reboot #3633

davepacheco opened this issue Jul 14, 2023 · 6 comments
Labels
known issue To include in customer documentation and training
Milestone

Comments

@davepacheco
Copy link
Collaborator

I haven't verified this but after talking with @smklein we believe that if a sled reboots, any customer Instances that were running on that system will no longer be running (not there, nor anywhere). But the API state will probably reflect that they are still running. It's not clear if there'd be any way to get them running again.

Part of the design here was that the sled_agent_put() call from the Sled Agent to Nexus would be an opportunity for Nexus to verify that the expected Instances were still running. In practice, this probably needs to trigger an RFD 373-style RPW that determines what's supposed to be on each Sled, what is running on each sled, and fixes things appropriately. It might be cleanest to factor that into two RPWs:

  • one RPW: checks what's supposed to be running on each Sled, checks what's running there, and for any discrepancies, marks the Instance failed (or something like that)
  • second RPW: for each failed Instance, try to start it elsewhere

There's a related issue here around sleds that have failed more permanently. I'd suggest we treat this as a different kind of thing and not try to automatically detect this using a heartbeat mechanism or something like that. That kind of automation can make things worse. For this case (which really should be rare), we could require that an operator mark the sled as "permanently gone -- remove it from the cluster", after which we mark its Instances failed.

@davepacheco davepacheco added this to the MVP milestone Jul 14, 2023
@askfongjojo
Copy link

askfongjojo commented Jul 21, 2023

One thing that came up in my conversation with our customer onsite is the ability for them to specify the autoboot behavior. If we can expose that as a user-configurable option, we don't have to make the decision for them on whether to bring up an instance when a sled-agent comes back up. Ideally:

  1. If autoboot is set to true, automatically recreate the propolis zone and start the instance.
  2. If autoboot is set to false, mark the instance as stopped in CRDB (plus any other necessary cleanup as if the instance was stopped by the user).
  3. If a zone is stuck in starting or stopping state, user or sled-agent has the ability to move it to failed state. This desired behavior is something not strictly related to sled/sled-agent reboot - it's useful even for an instance that doesn't get into running state for whatever reason. The biggest pain in this situation is that the disks attached to the instance are stuck and cannot be used any more (i.e. it's considered data loss from a user perspective).

@askfongjojo
Copy link

askfongjojo commented Jul 21, 2023

we could require that an operator mark the sled as "permanently gone -- remove it from the cluster", after which we mark its Instances failed.

A thought related to this different scenario: perhaps we can also mark the instance stopped and reset the active_sled_id and active_propolis_id in CRDB? This is assuming that we wire in the mechanism to pick a sled when starting an instance that has a NULL value in these attributes. Or we'd always blank out the sled/propolis ids as part of the process of stopping instances, as discussed in #2315.

To put things in perspective, I'd suggest that you substitute "customer instance" with "buildomat" and imagine how you'd want sled-agent to handle it in the scenarios we've discussed so far in this ticket (i.e. sled reboot, sled gone, instance staying in failed/starting/stopping status). 😅

@gjcolombo
Copy link
Contributor

Some drive-by commentary:

I haven't verified this but after talking with @smklein we believe that if a sled reboots, any customer Instances that were running on that system will no longer be running (not there, nor anywhere). But the API state will probably reflect that they are still running. It's not clear if there'd be any way to get them running again.

This is right AFAIK--the zones are gone, the instances aren't running, and there's no way to restore them to exactly the state they had when the sled rebooted. They can be cold-booted onto the same sled, but sled agent will need to be told to do this (it won't come back up and realize "oh hey I was running such-and-such instances here" and automatically restart them).

One thing that came up in my conversation with our customer onsite is the ability for them to specify the autoboot behavior.

I strongly agree with this--this should be configurable, if not now then in the (relatively) near future. With the caveat that I know basically nothing about Buildomat's internals, I can easily see it being an example of a sort of system where you wouldn't necessarily want a VM to come back up automatically if its sled reboots: Buildomat scheduler creates a VM; scheduler sends agent on the VM a set of commands; VM's sled reboots; scheduler decides the job is unresponsive and gives up on it; if the agent is then just sitting there waiting for commands, you've got a zombie VM. I can imagine enough workloads of this kind (i.e. where I don't want the VM to start unless I'm there to tell it to do something) that I feel pretty strongly that this behavior should be configurable.

If a zone is stuck in starting or stopping state, user or sled-agent has the ability to move it to failed state. This desired behavior is something not strictly related to sled/sled-agent reboot - it's useful even for an instance that doesn't get into running state for whatever reason. The biggest pain in this situation is that the disks attached to the instance are stuck and cannot be used any more (i.e. it's considered data loss from a user perspective).

FWIW there's now a sled agent API (instance_unregister) that forcibly terminates and unregisters an instance's zone irrespective of its prior state. There's currently no way to trigger it explicitly from Nexus (it's only invoked in the undo steps for sagas that rely on registering an instance), so we'd have to add that (and properly explain the semantics of that operation).

@jclulow
Copy link
Collaborator

jclulow commented Jul 21, 2023

I think it's probably better not to think of this as "autoboot" per se, as we're asking the user to think of the whole rack (and eventually a fleet of racks) as "the computer". From that perspective an individual sled rebooting is more like an individual disk or DIMM failing: that the sled "boots up" is an implementation detail.

Rather, if we expose a per-instance property I think it should be more explicitly about what to do after a fault which interrupts the instance. Something like "on_fault" which could have an initial choice of "restart" or "none" or something like that.

Additionally, I think it's important that we not consider customer instances as living on a particular sled. If they're restarted after a fault, they should go back through the regular instance placement process (in Nexus) that occurred when they were initially started, potentially ending up on a different sled.

@jclulow
Copy link
Collaborator

jclulow commented Jul 21, 2023

As an aside, buildomat uses a lot of AWS machines today, and we maintain a local catalogue of instances that we intend to create and have successfully been able to create. On instance boot we also register with the buildomat central API, which, if it occurs again later, we can use as a signal that something has gone terribly wrong with a particular instance.

We're also able to detect through listing instances any which are surplus to requirements and clean them up. I think you pretty much have to do all this if you're managing infrastructure in an EC2-like cloud environment and intending not to leak things.

@askfongjojo askfongjojo modified the milestones: MVP, 1.0.2 Aug 2, 2023
@iliana iliana added the known issue To include in customer documentation and training label Aug 11, 2023
@askfongjojo askfongjojo modified the milestones: 1.0.2, 1.0.3 Aug 22, 2023
@askfongjojo askfongjojo modified the milestones: 1.0.3, 3 Sep 1, 2023
@askfongjojo askfongjojo modified the milestones: 3, 4 Oct 21, 2023
@morlandi7 morlandi7 modified the milestones: 4, 5 Nov 14, 2023
@morlandi7 morlandi7 modified the milestones: 5, 6 Dec 4, 2023
@morlandi7 morlandi7 modified the milestones: 6, 7 Jan 25, 2024
@askfongjojo askfongjojo modified the milestones: 7, 9 Mar 9, 2024
@morlandi7 morlandi7 modified the milestones: 9, 10 Jul 1, 2024
@morlandi7 morlandi7 modified the milestones: 10, 11 Aug 14, 2024
@hawkw
Copy link
Member

hawkw commented Sep 24, 2024

Implemented in #6503.

@hawkw hawkw closed this as completed Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
known issue To include in customer documentation and training
Projects
None yet
Development

No branches or pull requests

7 participants