crushtool: rename "--check-names" to "--check"

* because "--check" also checks for the max_id

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2015-05-26 17:51:50 +08:00
parent 22e6bd6e01
commit 9381d53acd
3 changed files with 11 additions and 13 deletions

View File

@ -1,7 +1,7 @@
$ crushtool -i "$TESTDIR/simple.template" --add-item 0 1.0 device0 --loc host host0 --loc cluster cluster0 -o check-names.crushmap > /dev/null
$ crushtool -i check-names.crushmap --add-item 1 1.0 device1 --loc host host0 --loc cluster cluster0 -o check-names.crushmap > /dev/null
$ crushtool -i check-names.crushmap --check-names=2
$ crushtool -i check-names.crushmap --check 2
$ crushtool -i check-names.crushmap --add-item 2 1.0 device2 --loc host host0 --loc cluster cluster0 -o check-names.crushmap > /dev/null
$ crushtool -i check-names.crushmap --check-names=2
$ crushtool -i check-names.crushmap --check 2
item id too large: item#2
$ crushtool -i check-names.crushmap --check-names
$ crushtool -i check-names.crushmap --check

View File

@ -59,8 +59,7 @@
Options for the display/test stage
--tree print map summary as a tree
--check-names [max_id]
check if any item is referencing an unknown name/type
--check [max_id] check if any item is referencing an unknown name/type
-i mapfn --show-location id
show location for given device id
-i mapfn --test test a range of inputs on the map

View File

@ -165,8 +165,7 @@ void usage()
cout << "Options for the display/test stage\n";
cout << "\n";
cout << " --tree print map summary as a tree\n";
cout << " --check-names [max_id]\n";
cout << " check if any item is referencing an unknown name/type\n";
cout << " --check [max_id] check if any item is referencing an unknown name/type\n";
cout << " -i mapfn --show-location id\n";
cout << " show location for given device id\n";
cout << " -i mapfn --test test a range of inputs on the map\n";
@ -228,7 +227,7 @@ int main(int argc, const char **argv)
std::string infn, srcfn, outfn, add_name, remove_name, reweight_name;
bool compile = false;
bool decompile = false;
bool check_names = false;
bool check = false;
int max_id = -1;
bool test = false;
bool display = false;
@ -315,8 +314,8 @@ int main(int argc, const char **argv)
} else if (ceph_argparse_witharg(args, i, &val, "-c", "--compile", (char*)NULL)) {
srcfn = val;
compile = true;
} else if (ceph_argparse_witharg(args, i, &max_id, err, "--check-names", (char*)NULL)) {
check_names = true;
} else if (ceph_argparse_witharg(args, i, &max_id, err, "--check", (char*)NULL)) {
check = true;
} else if (ceph_argparse_flag(args, i, "-t", "--test", (char*)NULL)) {
test = true;
} else if (ceph_argparse_witharg(args, i, &full_location, err, "--show-location", (char*)NULL)) {
@ -503,7 +502,7 @@ int main(int argc, const char **argv)
}
}
if (test && !check_name && !display && !write_to_file) {
if (test && !check && !display && !write_to_file) {
cerr << "WARNING: no output selected; use --output-csv or --show-X" << std::endl;
}
@ -511,7 +510,7 @@ int main(int argc, const char **argv)
cerr << "cannot specify more than one of compile, decompile, and build" << std::endl;
exit(EXIT_FAILURE);
}
if (!check_names && !compile && !decompile && !build && !test && !reweight && !adjust && !tree &&
if (!check && !compile && !decompile && !build && !test && !reweight && !adjust && !tree &&
add_item < 0 && full_location < 0 &&
remove_name.empty() && reweight_name.empty()) {
cerr << "no action specified; -h for help" << std::endl;
@ -829,7 +828,7 @@ int main(int argc, const char **argv)
}
}
if (check_names) {
if (check) {
if (!tester.check_name_maps(max_id)) {
exit(1);
}