diff --git a/src/engine/strat_engine/liminal/device_info.rs b/src/engine/strat_engine/liminal/device_info.rs index 1b65aa22e23..358f96083ed 100644 --- a/src/engine/strat_engine/liminal/device_info.rs +++ b/src/engine/strat_engine/liminal/device_info.rs @@ -669,17 +669,22 @@ impl DeviceSet { /// The encryption information and devices registered for stopped pools to /// be exported over the API. /// - /// Error from gather_encryption_info is converted into an option because - /// unlocked Stratis devices and LUKS2 devices on which the Stratis devices are - /// stored may appear at different times in udev. This is not necessarily - /// an error case and may resolve itself after more devices appear in udev. - pub fn stopped_pool_info(&self) -> Option { - gather_encryption_info( + /// Converts an error result from gather_encryption_info into maximum + /// uncertainty, since the error means that encryption information is + /// completely missing from one device. + pub fn stopped_pool_info(&self) -> StoppedPoolInfo { + let info = gather_encryption_info( self.internal.len(), self.internal.values().map(|info| info.encryption_info()), ) - .ok() - .map(|info| StoppedPoolInfo { + .unwrap_or({ + Some(PoolEncryptionInfo::Both( + MaybeInconsistent::Yes, + MaybeInconsistent::Yes, + )) + }); + + StoppedPoolInfo { info, devices: self .internal @@ -699,7 +704,7 @@ impl DeviceSet { } }) .collect::>(), - }) + } } /// Process the data from a remove udev event. Since remove events are diff --git a/src/engine/strat_engine/liminal/liminal.rs b/src/engine/strat_engine/liminal/liminal.rs index f93a6bdae13..fcdc973a7cf 100644 --- a/src/engine/strat_engine/liminal/liminal.rs +++ b/src/engine/strat_engine/liminal/liminal.rs @@ -401,16 +401,12 @@ impl LiminalDevices { stopped: self .stopped_pools .iter() - .filter_map(|(pool_uuid, map)| { - map.stopped_pool_info().map(|info| (*pool_uuid, info)) - }) + .map(|(pool_uuid, map)| (*pool_uuid, map.stopped_pool_info())) .collect(), partially_constructed: self .partially_constructed_pools .iter() - .filter_map(|(pool_uuid, map)| { - map.stopped_pool_info().map(|info| (*pool_uuid, info)) - }) + .map(|(pool_uuid, map)| (*pool_uuid, map.stopped_pool_info())) .collect(), } }