Repository navigation
[live-update] adapt instance update saga to account for VMMs stopped by reconfigurator - #11491
Conversation
| (InstanceState::SledEvacuating, None) => { | ||
| instance::InstanceState::Rebooting | ||
| } |
| /// Instance states where there is not currently a VMM incarnating this | ||
| /// instance, but might be in the future. | ||
| pub const NOT_INCARNATED_STATES: &'static [InstanceState] = | ||
| &[InstanceState::NoVmm, InstanceState::Creating, InstanceState::Failed]; |
There was a problem hiding this comment.
Hmm, so this is a bit funny, because if we follow the intended meaning of this set of states, especially based on the comment, SledEvacuating should probably be added to this list of states, but...I really don't think it actually should be. Looking at the places where we actually consume NOT_INCARNATED_STATES, it is mostly used to determine whether you can change the instance's vCPU/memory config:
omicron/nexus/db-queries/src/db/datastore/instance.rs
Lines 1283 to 1300 in 8e361f6
...or change its boot disk:
omicron/nexus/db-queries/src/db/datastore/instance.rs
Lines 1188 to 1226 in 8e361f6
And I think it's probably safer to not let you mess with stuff if the VM is in the process of being restarted, because it just sort of may or may not actually work depending on whether you happen to click the button before or after we've started a new start saga, and that's kind of a disappointing experience. So...maybe it's worth a comment in here noting "it seems like SledEvacuating belongs here but ..." so that future readers can understand that (and why you might want to change it later if we decide to relax that restriction...)
There was a problem hiding this comment.
Yep! not allowing changes to the instance was one of the main drivers in using a new state here.
From #11169 (comment):
- NoVmm is part of InstanceState::NOT_INCARNATED_STATES. This constant is used to allow users to update cpu/memory and change the boot disk when the instance is in one of these states. We may want to allow users to update these parameters during an update in the future, but for now we should take small steps. During an update there are a lot of things going on, we should be conservative and disallow these changes to start with. Once we see the process running smoothly we can relax these constraints and allow users to update cpu/memory/boot disk during an update.
- Other actions like disk attach/detach, deletion, NIC changes and external IP attaches allow changes when the Instance is in a NoVmm state. for the same reasons above, we want to disallow those actions during an update for now.
I can add a comment though
There was a problem hiding this comment.
Yeah, I think that's right, I just figured we should explicitly mention it in case someone else comes along and wonders about it.
There was a problem hiding this comment.
I was going to say that if we want to have the instance_reincarnation task reincarnate SledEvacuated instances, we will also want to make the final saga node activate it (just to reduce the latency for when the VM gets restarted), here:
https://github.com/karencfv/omicron/blob/abf4fa55f5980ff261be1f70323828b67200c303/nexus/src/app/sagas/instance_update/mod.rs#L1622-L1630
...but after actually looking at that code again, I see that it is just checking if the reincarnation task should be activated by calling should_reincarnate(), and the subsequent change to make these instances eligible to be restarted by the instance-reincarnation task will change that anyway, so we don't actually need to update that function separately from making that change.
HOWEVER, I did notice there's a log line there that says "transitioned to Failed" which we should probably change to say the actual state we're transitioning the instance to, because it might not be Failed: https://github.com/karencfv/omicron/blob/abf4fa55f5980ff261be1f70323828b67200c303/nexus/src/app/sagas/instance_update/mod.rs#L1633-L1635
There was a problem hiding this comment.
Thanks for the heads up! I'll make those changes in #11504 (this PR is just a placeholder right now with a couple of changes, so not ready at all)
…ations (#11504) Introduces a new `ReincarnationReason::SledEvacuation` reason, and adapts the instance reincarnation background task to account for this new variant. Something to note is that we are explicitly overriding the auto-restart policy to "best effort" for all instances, this is because the [API documentation](https://docs.oxide.computer/api/instance_create#request.auto_restart_policy) for this setting explicitly says: > This policy determines whether the instance should be automatically restarted by the control plane on failure These instances haven't actually failed, so we don't take that setting into account. Depends on: #11491 Related: #11169
Adds a new internal
SledEvacuatinginstance state to indicate that an instance has been stopped due to a sled evacuation. It differs toNoVmmin the sense that we know the instance will be automatically started again soon. In addition, we don't allow any changes (e.g. add/detach a disk, deletion, etc) during this state, and we map it to the external instance stateRebooting.Also, the instance update saga is modified to account for VMMs in this new state.
NB: This work will be tested through #11380. Once that is merged, the
vmm_stop_for_updatebackground task's tests will fail since they currently check for aNoVmmstate. This PR will include the changes in those tests. I just want to get some eyes in this PR since it's basically ready to go otherwise.Depends on: #11380
Related: #11169