1
0
mirror of https://github.com/containers/bootc.git synced 2026-02-05 06:45:13 +01:00

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 <jeckersb@redhat.com>
Closes: #1659
This commit is contained in:
John Eckersberg
2025-10-02 16:48:48 -04:00
committed by Colin Walters
parent 24f2dd0b87
commit 4d56384290

View File

@@ -2,7 +2,7 @@ use std::process::Command;
use anyhow::Result;
use bootc_mount::run_findmnt;
use bootc_utils::CommandRunExt;
use bootc_utils::{CommandRunExt, ResultExt};
use serde::Deserialize;
#[derive(Debug, Deserialize)]
@@ -54,7 +54,7 @@ pub(crate) fn check_root_siblings() -> Result<Vec<String>> {
let siblings: Vec<String> = all_volumes
.iter()
.filter(|lv| {
let mount = run_findmnt(&["-S", &lv.lv_path], None).unwrap_or_default();
let mount = run_findmnt(&["-S", &lv.lv_path], None).log_err_default();
if let Some(fs) = mount.filesystems.first() {
&fs.target == "/"
} else {
@@ -63,14 +63,14 @@ pub(crate) fn check_root_siblings() -> Result<Vec<String>> {
})
.flat_map(|root_lv| parse_volumes(Some(root_lv.vg_name.as_str())).unwrap_or_default())
.try_fold(Vec::new(), |mut acc, r| -> anyhow::Result<_> {
let mount = run_findmnt(&["-S", &r.lv_path], None)?;
let mount = run_findmnt(&["-S", &r.lv_path], None).log_err_default();
let mount_path = if let Some(fs) = mount.filesystems.first() {
&fs.target
} else {
""
};
if mount_path != "/" {
if mount_path != "/" && !mount_path.is_empty() {
acc.push(format!(
"Type: LVM, Mount Point: {}, LV: {}, VG: {}, Size: {}",
mount_path, r.lv_name, r.vg_name, r.lv_size