From 7f6765d7eb0d9f79925d4eb382c9fffa268e9e7d Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Mon, 5 Aug 2024 16:51:10 -0700 Subject: [PATCH] fix completed updates spawning spurious update sagas --- nexus/src/app/sagas/instance_update/mod.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nexus/src/app/sagas/instance_update/mod.rs b/nexus/src/app/sagas/instance_update/mod.rs index 09439b15026..a1dd9a1757f 100644 --- a/nexus/src/app/sagas/instance_update/mod.rs +++ b/nexus/src/app/sagas/instance_update/mod.rs @@ -576,6 +576,7 @@ impl UpdatesRequired { new_runtime.propolis_id = Some(migration.target_propolis_id); network_config = Some(NetworkConfigUpdate::to_vmm(new_vmm)); + update_required = true; } // Welp, the migration has succeeded, but the target Propolis @@ -593,6 +594,7 @@ impl UpdatesRequired { "target_propolis_id" => %migration.target_propolis_id, ); new_runtime.propolis_id = None; + update_required = true; } // If the target reports that the migration has completed, @@ -612,9 +614,8 @@ impl UpdatesRequired { ); new_runtime.migration_id = None; new_runtime.dst_propolis_id = None; + update_required = true; } - - update_required = true; } } @@ -625,7 +626,11 @@ impl UpdatesRequired { // instance is no longer incarnated on a sled, and we must update the // state of the world to reflect that. let deprovision = if new_runtime.propolis_id.is_none() { - update_required = true; + // N.B. that this does *not* set `update_required`, because + // `new_runtime.propolis_id` might be `None` just because there was, + // already, no VMM there. `update_required` gets set above if there + // was any actual state change. + // We no longer have a VMM. new_runtime.nexus_state = InstanceState::NoVmm; // If the active VMM was destroyed and the instance has not migrated