[thin_check] rename --fix-metadata-leaks to --auto-repair

This flag will cover all trivial fixes, such as data leaks.
This commit is contained in:
Joe Thornber 2020-08-12 10:45:20 +01:00
parent ebcfc322c0
commit 2860b4c0b1
4 changed files with 17 additions and 13 deletions

View File

@ -30,7 +30,7 @@ Options:
{-h|--help}
{-V|--version}
{-m|--metadata-snap}
{--fix-metadata-leaks}
{--auto-repair}
{--override-mapping-root}
{--clear-needs-check-flag}
{--ignore-non-fatal-errors}

View File

@ -95,14 +95,14 @@
"Unrecognised option should cause failure"
(run-fail (thin-check "--hedgehogs-only")))
(define-scenario (thin-check incompatible-options fix-metadata-leaks)
(define-scenario (thin-check incompatible-options auto-repair)
"Incompatible options should cause failure"
(with-valid-metadata (md)
(run-fail (thin-check "--fix-metadata-leaks" "-m" md))
(run-fail (thin-check "--fix-metadata-leaks" "--override-mapping-root 123" md))
(run-fail (thin-check "--fix-metadata-leaks" "--super-block-only" md))
(run-fail (thin-check "--fix-metadata-leaks" "--skip-mappings" md))
(run-fail (thin-check "--fix-metadata-leaks" "--ignore-non-fatal-errors" md))))
(run-fail (thin-check "--auto-repair" "-m" md))
(run-fail (thin-check "--auto-repair" "--override-mapping-root 123" md))
(run-fail (thin-check "--auto-repair" "--super-block-only" md))
(run-fail (thin-check "--auto-repair" "--skip-mappings" md))
(run-fail (thin-check "--auto-repair" "--ignore-non-fatal-errors" md))))
(define-scenario (thin-check incompatible-options clear-needs-check-flag)
"Incompatible options should cause failure"
@ -145,10 +145,10 @@
(with-valid-metadata (md)
(run-ok (thin-check "--clear-needs-check-flag" md))))
(define-scenario (thin-check fix-metadata-leaks)
"Accepts --fix-metadata-leaks"
(define-scenario (thin-check auto-repair)
"Accepts --auto-repair"
(with-valid-metadata (md)
(run-ok (thin-check "--fix-metadata-leaks" md))))
(run-ok (thin-check "--auto-repair" md))))
(define-scenario (thin-check tiny-metadata)
"Prints helpful message in case tiny metadata given"

View File

@ -40,6 +40,10 @@ OPTIONS
The snap does not contain space maps, so these will not be checked. This
may be used on live metadata.
--auto-repair Automatically repair any trivial issues found with the metadata.
Currently only fixes metadata leaks.
--override-mapping-root <block> Specify a mapping root to use.
Don't use this. This overrides what's specified in the superblock. Only

View File

@ -92,7 +92,7 @@ thin_check_cmd::usage(std::ostream &out) const
<< " {-h|--help}\n"
<< " {-V|--version}\n"
<< " {-m|--metadata-snap}\n"
<< " {--fix-metadata-leaks}\n"
<< " {--auto-repair}\n"
<< " {--override-mapping-root}\n"
<< " {--clear-needs-check-flag}\n"
<< " {--ignore-non-fatal-errors}\n"
@ -117,7 +117,7 @@ thin_check_cmd::run(int argc, char **argv)
{ "ignore-non-fatal-errors", no_argument, NULL, 3},
{ "clear-needs-check-flag", no_argument, NULL, 4 },
{ "override-mapping-root", required_argument, NULL, 5},
{ "fix-metadata-leaks", no_argument, NULL, 6},
{ "auto-repair", no_argument, NULL, 6},
{ NULL, no_argument, NULL, 0 }
};
@ -165,7 +165,7 @@ thin_check_cmd::run(int argc, char **argv)
break;
case 6:
// fix-metadata-leaks
// auto-repair
fs.check_opts.set_fix_metadata_leaks();
break;