$ crushtool -d five -o final
$ cmp final "$TESTDIR/simple.template.five"
$ crushtool -i five --update-item 1 2.0 osd1 --loc host host1 --loc cluster cluster0 -o six > /dev/null
+ $ crushtool -i five --show-location 1
+ cluster\tcluster0 (esc)
+ host\thost1 (esc)
$ crushtool -d six -o final
$ cmp final "$TESTDIR/simple.template.five"
--- /dev/null
+ $ crushtool -i $TESTDIR/test-map-big-1.crushmap --show-location 44
+ $ crushtool -i $TESTDIR/test-map-big-1.crushmap --show-location 16
+ $ crushtool -i $TESTDIR/test-map-big-1.crushmap --show-location 167
+ host\tp05151113587529 (esc)
+ rack\tRJ45 (esc)
+ room\t0513-R-0050 (esc)
+ root\tdefault (esc)
+ $ crushtool -i $TESTDIR/test-map-big-1.crushmap --show-location 258
+ host\tlxfssi44a06 (esc)
+ rack\tSI44 (esc)
+ root\tcastor (esc)
+ $ crushtool -i $TESTDIR/test-map-big-1.crushmap --show-location 87
+ host\tp05151113576052 (esc)
+ rack\tRJ43 (esc)
+ room\t0513-R-0050 (esc)
+ root\tdefault (esc)
cout << " reweight a given item (and adjust ancestor\n"
<< " weights as needed)\n";
cout << " -i mapfn --reweight recalculate all bucket weights\n";
+ cout << " -i mapfn --show-location id\n";
+ cout << " show location for given device id\n";
cout << " --show-utilization show OSD usage\n";
cout << " --show utilization-all\n";
cout << " include zero weight items\n";
bool decompile = false;
bool test = false;
bool display = false;
+ int full_location = -1;
bool write_to_file = false;
int verbose = 0;
bool unsafe_tunables = false;
compile = true;
} else if (ceph_argparse_flag(args, i, "-t", "--test", (char*)NULL)) {
test = true;
+ } else if (ceph_argparse_withint(args, i, &full_location, &err, "--show-location", (char*)NULL)) {
} else if (ceph_argparse_flag(args, i, "-s", "--simulate", (char*)NULL)) {
tester.set_random_placement();
} else if (ceph_argparse_flag(args, i, "--enable-unsafe-tunables", (char*)NULL)) {
exit(EXIT_FAILURE);
}
if (!compile && !decompile && !build && !test && !reweight && !adjust &&
- add_item < 0 &&
+ add_item < 0 && full_location < 0 &&
remove_name.empty() && reweight_name.empty()) {
cerr << "no action specified; -h for help" << std::endl;
exit(EXIT_FAILURE);
crush.decode(p);
}
+ if (full_location >= 0) {
+ map<string, string> loc = crush.get_full_location(full_location);
+ for (map<string,string>::iterator p = loc.begin();
+ p != loc.end();
+ ++p) {
+ cout << p->first << "\t" << p->second << std::endl;
+ }
+ exit(0);
+ }
if (decompile) {
CrushCompiler cc(crush, cerr, verbose);
if (!outfn.empty()) {