Skip to content

Commit

Permalink
Include device set even if encryption info missing
Browse files Browse the repository at this point in the history
If there is encryption info on some devices but not others, just assume
maximum possible inconsistency in the encryption.

Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed May 31, 2023
1 parent 896d148 commit 451b196
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
23 changes: 14 additions & 9 deletions src/engine/strat_engine/liminal/device_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<StoppedPoolInfo> {
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
Expand All @@ -699,7 +704,7 @@ impl DeviceSet {
}
})
.collect::<Vec<_>>(),
})
}
}

/// Process the data from a remove udev event. Since remove events are
Expand Down
8 changes: 2 additions & 6 deletions src/engine/strat_engine/liminal/liminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}
Expand Down

0 comments on commit 451b196

Please sign in to comment.