[thin_check] --ignore-non-fatal-errors
This commit is contained in:
parent
84858ab86e
commit
e7303a11c6
@ -39,6 +39,7 @@ Feature: thin_check
|
|||||||
{-V|--version}
|
{-V|--version}
|
||||||
{--super-block-only}
|
{--super-block-only}
|
||||||
{--skip-mappings}
|
{--skip-mappings}
|
||||||
|
{--ignore-non-fatal-errors}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Scenario: Unrecognised option should cause failure
|
Scenario: Unrecognised option should cause failure
|
||||||
@ -64,3 +65,8 @@ Feature: thin_check
|
|||||||
Given valid metadata
|
Given valid metadata
|
||||||
When I run thin_check with --skip-mappings
|
When I run thin_check with --skip-mappings
|
||||||
Then it should pass
|
Then it should pass
|
||||||
|
|
||||||
|
Scenario: --ignore-non-fatal-errors check passes on valid metadata
|
||||||
|
Given valid metadata
|
||||||
|
When I run thin_check with --ignore-non-fatal-errors
|
||||||
|
Then it should pass
|
@ -32,6 +32,14 @@ Only check the superblock is present.
|
|||||||
Skip checking of the block mappings which make up the bulk of the
|
Skip checking of the block mappings which make up the bulk of the
|
||||||
metadata.
|
metadata.
|
||||||
|
|
||||||
|
.IP "\fB\-\-ignore\-non\-fatal\-errors\fP"
|
||||||
|
.B thin_check
|
||||||
|
will only return a non-zero exit code if it finds a fatal
|
||||||
|
error. An example of a on fatal error is an incorrect data block
|
||||||
|
reference count causing a block to be considered allocated when it in
|
||||||
|
fact isn't. Ignoring errors for a long time is not advised, you
|
||||||
|
really should be using thin_repair to fix them.
|
||||||
|
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
Analyses and repairs thin provisioning metadata on logical volume
|
Analyses and repairs thin provisioning metadata on logical volume
|
||||||
/dev/vg/metadata:
|
/dev/vg/metadata:
|
||||||
|
@ -233,6 +233,8 @@ namespace {
|
|||||||
bool check_device_tree;
|
bool check_device_tree;
|
||||||
bool check_mapping_tree_level1;
|
bool check_mapping_tree_level1;
|
||||||
bool check_mapping_tree_level2;
|
bool check_mapping_tree_level2;
|
||||||
|
|
||||||
|
bool ignore_non_fatal_errors;
|
||||||
};
|
};
|
||||||
|
|
||||||
error_state metadata_check(string const &path, flags fs) {
|
error_state metadata_check(string const &path, flags fs) {
|
||||||
@ -299,6 +301,9 @@ namespace {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fs.ignore_non_fatal_errors)
|
||||||
|
return (err == FATAL) ? 1 : 0;
|
||||||
|
else
|
||||||
return (err == NO_ERROR) ? 0 : 1;
|
return (err == NO_ERROR) ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +314,8 @@ namespace {
|
|||||||
<< " {-h|--help}" << endl
|
<< " {-h|--help}" << endl
|
||||||
<< " {-V|--version}" << endl
|
<< " {-V|--version}" << endl
|
||||||
<< " {--super-block-only}" << endl
|
<< " {--super-block-only}" << endl
|
||||||
<< " {--skip-mappings}" << endl;
|
<< " {--skip-mappings}" << endl
|
||||||
|
<< " {--ignore-non-fatal-errors}" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,12 +331,14 @@ int main(int argc, char **argv)
|
|||||||
{ "version", no_argument, NULL, 'V'},
|
{ "version", no_argument, NULL, 'V'},
|
||||||
{ "super-block-only", no_argument, NULL, 1},
|
{ "super-block-only", no_argument, NULL, 1},
|
||||||
{ "skip-mappings", no_argument, NULL, 2},
|
{ "skip-mappings", no_argument, NULL, 2},
|
||||||
|
{ "ignore-non-fatal-errors", no_argument, NULL, 3},
|
||||||
{ NULL, no_argument, NULL, 0 }
|
{ NULL, no_argument, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
fs.check_device_tree = true;
|
fs.check_device_tree = true;
|
||||||
fs.check_mapping_tree_level1 = true;
|
fs.check_mapping_tree_level1 = true;
|
||||||
fs.check_mapping_tree_level2 = true;
|
fs.check_mapping_tree_level2 = true;
|
||||||
|
fs.ignore_non_fatal_errors = false;
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
|
while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
@ -358,6 +366,11 @@ int main(int argc, char **argv)
|
|||||||
fs.check_mapping_tree_level2 = false;
|
fs.check_mapping_tree_level2 = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
// ignore-non-fatal-errors
|
||||||
|
fs.ignore_non_fatal_errors = true;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
usage(cerr, basename(argv[0]));
|
usage(cerr, basename(argv[0]));
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user