Skip to content

Commit

Permalink
Fix bug in sim engine
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jbaublitz committed Jan 7, 2025
1 parent 0706663 commit 2f89dfb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/engine/sim_engine/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)));
Expand Down

0 comments on commit 2f89dfb

Please sign in to comment.