Skip to content

Commit

Permalink
wip: fix up logging after instance put failures; add TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
gjcolombo committed Sep 15, 2023
1 parent b2939bb commit fb3c6e3
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions nexus/src/app/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand All @@ -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)
}
Expand Down

0 comments on commit fb3c6e3

Please sign in to comment.