Walk the parent chain to find all root (whole disk) devices, and fail if more than one root is found. This is a convenience wrapper around `find_all_roots` for callers that expect exactly one backing device (e.g. non-RAID setups).
(&self)
| 408 | /// This is a convenience wrapper around `find_all_roots` for callers |
| 409 | /// that expect exactly one backing device (e.g. non-RAID setups). |
| 410 | pub fn require_single_root(&self) -> Result<Device> { |
| 411 | let mut roots = self.find_all_roots()?; |
| 412 | match roots.len() { |
| 413 | 1 => Ok(roots.remove(0)), |
| 414 | n => anyhow::bail!( |
| 415 | "Expected a single root device for {}, but found {n}", |
| 416 | self.path() |
| 417 | ), |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | /// Walk the parent chain to find all root (whole disk) devices. |
| 422 | /// |
no test coverage detected