From 10ce1bb1e30eb8312e1586d05bf40bf8edfb0192 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Thu, 11 Jul 2024 13:38:01 -0700 Subject: [PATCH] whoops, migration arm needs to be BEFORE destroyed --- nexus/db-queries/src/db/datastore/instance.rs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/nexus/db-queries/src/db/datastore/instance.rs b/nexus/db-queries/src/db/datastore/instance.rs index 9b403fde3e6..b7091f17c3c 100644 --- a/nexus/db-queries/src/db/datastore/instance.rs +++ b/nexus/db-queries/src/db/datastore/instance.rs @@ -109,18 +109,6 @@ impl From for external::Instance { // We want to only report that an instance is `Stopped` when a new // `instance-start` saga is able to proceed. That means that: let run_state = match (instance_state, vmm_state) { - // - An instance with a "stopped" or "destroyed" VMM needs to be - // recast as a "stopping" instance, as the virtual provisioning - // resources for that instance have not been deallocated until the - // active VMM ID has been unlinked by an update saga. - ( - InstanceState::Vmm, - Some( - VmmState::Stopped - | VmmState::Destroyed - | VmmState::SagaUnwound, - ), - ) => external::InstanceState::Stopping, // - If there's an active migration ID for the instance, *always* // treat its state as "migration" regardless of the VMM's state. // @@ -143,6 +131,18 @@ impl From for external::Instance { { external::InstanceState::Migrating } + // - An instance with a "stopped" or "destroyed" VMM needs to be + // recast as a "stopping" instance, as the virtual provisioning + // resources for that instance have not been deallocated until the + // active VMM ID has been unlinked by an update saga. + ( + InstanceState::Vmm, + Some( + VmmState::Stopped + | VmmState::Destroyed + | VmmState::SagaUnwound, + ), + ) => external::InstanceState::Stopping, // - An instance with no VMM is always "stopped" (as long as it's // not "starting" etc.) (InstanceState::NoVmm, _vmm_state) => {