$ crushtool -c "$TESTDIR/check-names.empty.crushmap.txt" -o "$TESTDIR/check-names.empty.crushmap"
- $ crushtool -i "$TESTDIR/check-names.empty.crushmap" --check-names
+ $ crushtool -i "$TESTDIR/check-names.empty.crushmap" --check 0
unknown type name: item#0
+ [1]
$ rm -f "$TESTDIR/check-names.empty.crushmap"
--- /dev/null
+ $ 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 --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
+ item id too large: item#2
+ [1]
Options for the display/test stage
- --check-names check if any item is referencing an unknown name/type
+ --check-names max_id
+ check if any item is referencing an unknown name/type
-i mapfn --show-location id
show location for given device id
--show-utilization show OSD usage
cout << "\n";
cout << "Options for the display/test stage\n";
cout << "\n";
- cout << " --check-names check if any item is referencing an unknown name/type\n";
+ cout << " --check-names max_id\n";
+ cout << " 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 << " --show-utilization show OSD usage\n";
bool compile = false;
bool decompile = false;
bool check_names = false;
+ int max_id = -1;
bool test = false;
bool display = false;
bool tree = false;
} else if (ceph_argparse_witharg(args, i, &val, "-c", "--compile", (char*)NULL)) {
srcfn = val;
compile = true;
- } else if (ceph_argparse_flag(args, i, "--check-names", (char*)NULL)) {
+ } else if (ceph_argparse_withint(args, i, &max_id, &err, "--check-names", (char*)NULL)) {
check_names = true;
} else if (ceph_argparse_flag(args, i, "-t", "--test", (char*)NULL)) {
test = true;
}
if (modified) {
- crush.finalize();
+ crush.finalize();
if (outfn.empty()) {
cout << me << " successfully built or modified map. Use '-o <file>' to write it out." << std::endl;
}
if (check_names) {
- if (!tester.check_name_maps()) {
+ if (!tester.check_name_maps(max_id)) {
exit(1);
}
}