Skip to content

Commit 4d56384

Browse files
jeckersbcgwalters
authored andcommitted
system-reinstall-bootc: Do not warn on unmounted LVM volumes
If the system has a swap partition (or any other volume which is not currently mounted) the `findmnt` command will (expectedly) fail to find it. Don't early exit in this case, instead just ignore that volume. If it wasn't mounted in the first place, we don't need to warn about it being unmounted after the reinstall operation is complete. Signed-off-by: John Eckersberg <[email protected]> Closes: #1659
1 parent 24f2dd0 commit 4d56384

File tree

1 file changed

+4
-4
lines changed
  • crates/system-reinstall-bootc/src

1 file changed

+4
-4
lines changed

crates/system-reinstall-bootc/src/lvm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::process::Command;
22

33
use anyhow::Result;
44
use bootc_mount::run_findmnt;
5-
use bootc_utils::CommandRunExt;
5+
use bootc_utils::{CommandRunExt, ResultExt};
66
use serde::Deserialize;
77

88
#[derive(Debug, Deserialize)]
@@ -54,7 +54,7 @@ pub(crate) fn check_root_siblings() -> Result<Vec<String>> {
5454
let siblings: Vec<String> = all_volumes
5555
.iter()
5656
.filter(|lv| {
57-
let mount = run_findmnt(&["-S", &lv.lv_path], None).unwrap_or_default();
57+
let mount = run_findmnt(&["-S", &lv.lv_path], None).log_err_default();
5858
if let Some(fs) = mount.filesystems.first() {
5959
&fs.target == "/"
6060
} else {
@@ -63,14 +63,14 @@ pub(crate) fn check_root_siblings() -> Result<Vec<String>> {
6363
})
6464
.flat_map(|root_lv| parse_volumes(Some(root_lv.vg_name.as_str())).unwrap_or_default())
6565
.try_fold(Vec::new(), |mut acc, r| -> anyhow::Result<_> {
66-
let mount = run_findmnt(&["-S", &r.lv_path], None)?;
66+
let mount = run_findmnt(&["-S", &r.lv_path], None).log_err_default();
6767
let mount_path = if let Some(fs) = mount.filesystems.first() {
6868
&fs.target
6969
} else {
7070
""
7171
};
7272

73-
if mount_path != "/" {
73+
if mount_path != "/" && !mount_path.is_empty() {
7474
acc.push(format!(
7575
"Type: LVM, Mount Point: {}, LV: {}, VG: {}, Size: {}",
7676
mount_path, r.lv_name, r.vg_name, r.lv_size

0 commit comments

Comments
 (0)