diff --git a/nexus/src/app/instance.rs b/nexus/src/app/instance.rs index 4915588b588..0f8aae23335 100644 --- a/nexus/src/app/instance.rs +++ b/nexus/src/app/instance.rs @@ -1109,6 +1109,13 @@ impl super::Nexus { // Internal server error (or anything else) should change // the instance state to failed, we don't know what state // the instance is in. + // + // TODO(gjc) do we also need to clear the propolis_id at + // this point? this is a tricky bit in start saga unwind: we + // want to set the instance back to Stopped, but this + // failure can move the instance to Failed without actually + // clearing the active Propolis ID, which prevents it from + // being deleted. hmm. _ => { let new_instance = db::model::InstanceVmmState { no_vmm_state: db::model::InstanceState::new( @@ -1121,6 +1128,11 @@ impl super::Nexus { ..prev_instance_vmm.clone() }; + info!(self.log, + "setting instance to Failed after failed state change"; + "instance_id" => %instance_id, + "new_state" => ?new_instance); + // XXX what if this fails? let result = self .db_datastore @@ -1130,12 +1142,14 @@ impl super::Nexus { ) .await; - error!( - self.log, - "error setting Failed state after bad instance_put"; - "instance_id" => %instance_id, - "result" => ?result - ); + if result.is_err() { + error!( + self.log, + "error setting Failed state after bad instance_put"; + "instance_id" => %instance_id, + "result" => ?result + ); + } Err(e) }