[thin_check] Allow using --clear-needs-check and --skip-mappings together

Although it is not recommended to clear the flag without a full
examination, however, the usage has been documented as an approach
to reduce lvchange run time [1]. For the purpose of backward
compatibility and avoiding boot failure after upgrading thin_check [2],
the limitation is now removed.

[1] https://wiki.archlinux.org/index.php/LVM#Thinly-provisioned_root_volume_device_times_out
[2] Community feedback on previous commit:
    https://github.com/jthornber/thin-provisioning-tools/commit/b278f4f
This commit is contained in:
Ming-Hung Tsai
2020-08-21 18:26:48 +08:00
parent f364de35bc
commit 1fe8a0dbde
3 changed files with 53 additions and 39 deletions

View File

@@ -166,11 +166,6 @@ fn clear_needs_check_incompatible_opts() -> Result<()> {
"--super-block-only",
&md
))?;
run_fail(thin_check!(
"--clear-needs-check-flag",
"--skip-mappings",
&md
))?;
run_fail(thin_check!(
"--clear-needs-check-flag",
"--ignore-non-fatal-errors",
@@ -204,6 +199,19 @@ fn no_clear_needs_check_if_error() -> Result<()> {
Ok(())
}
#[test]
fn clear_needs_check_if_skip_mappings() -> Result<()> {
let mut td = TestDir::new()?;
let md = prep_metadata(&mut td)?;
set_needs_check(&md)?;
generate_metadata_leaks(&md, 1, 0, 1)?;
assert!(get_needs_check(&md)?);
thin_check!("--clear-needs-check-flag", "--skip-mappings", &md).run()?;
assert!(!get_needs_check(&md)?);
Ok(())
}
#[test]
fn metadata_leaks_are_non_fatal() -> Result<()> {
let mut td = TestDir::new()?;