From 2f89dfb1dd96ec7110ce88768417f3a12bd16fbc Mon Sep 17 00:00:00 2001 From: John Baublitz Date: Tue, 7 Jan 2025 10:27:30 -0500 Subject: [PATCH] Fix bug in sim engine This commit fixes a bug where an error starting a pool in the sim engine will cause the pool to disappear instead of being readded to stopped pools. --- src/engine/sim_engine/engine.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/engine/sim_engine/engine.rs b/src/engine/sim_engine/engine.rs index c2cc44c595..0aaa178ff8 100644 --- a/src/engine/sim_engine/engine.rs +++ b/src/engine/sim_engine/engine.rs @@ -346,14 +346,26 @@ impl Engine for SimEngine { .map(|(n, p)| (n, u, p))?, }; if pool.is_encrypted() && unlock_method.is_none() { + self.stopped_pools + .write() + .await + .insert(name, pool_uuid, pool); return Err(StratisError::Msg(format!( "Pool with UUID {pool_uuid} is encrypted but no unlock method was provided" ))); } else if !pool.is_encrypted() && unlock_method.is_some() { + self.stopped_pools + .write() + .await + .insert(name, pool_uuid, pool); return Err(StratisError::Msg(format!( "Pool with UUID {pool_uuid} is not encrypted but an unlock method was provided" ))); } else if !pool.is_encrypted() && passphrase_fd.is_some() { + self.stopped_pools + .write() + .await + .insert(name, pool_uuid, pool); return Err(StratisError::Msg(format!( "Pool with UUID {pool_uuid} is not encrypted but a passphrase was provided" )));