cout << " table, table-kv, html, html-pretty\n";
cout << " --dump dump the crush map\n";
cout << " --tree print map summary as a tree\n";
+ cout << " --bucket-tree print bucket map summary as a tree\n";
+ cout << " --bucket-name specify bucket bucket name for bucket-tree\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";
}
const char *me = argv[0];
- std::string infn, srcfn, outfn, add_name, add_type, remove_name, reweight_name;
+
+ std::string infn, srcfn, outfn, add_name, add_type, remove_name,
+ reweight_name, bucket_name;
std::string move_name;
bool compile = false;
bool decompile = false;
bool test = false;
bool display = false;
bool tree = false;
+ bool bucket_tree = false;
string dump_format = "json-pretty";
bool dump = false;
int full_location = -1;
i = args.erase(i);
} else if (ceph_argparse_flag(args, i, "--tree", (char*)NULL)) {
tree = true;
+ } else if (ceph_argparse_flag(args, i, "--bucket-tree", (char*)NULL)) {
+ bucket_tree = true;
+ } else if (ceph_argparse_witharg(args, i, &val, "-b", "--bucket-name", (char*)NULL)) {
+ bucket_name = val;
} else if (ceph_argparse_witharg(args, i, &val, "-f", "--format", (char*)NULL)) {
dump_format = val;
} else if (ceph_argparse_flag(args, i, "--dump", (char*)NULL)) {
}
if (!check && !compile && !decompile && !build && !test && !reweight && !adjust && !tree && !dump &&
add_item < 0 && !add_bucket && !move_item && !add_rule && !del_rule && full_location < 0 &&
+ !bucket_tree &&
!reclassify && !rebuild_class_roots &&
compare.empty() &&
+
remove_name.empty() && reweight_name.empty()) {
cerr << "no action specified; -h for help" << std::endl;
return EXIT_FAILURE;
crush.dump_tree(&cout, NULL, {}, true);
}
+ if (bucket_tree) {
+ if (bucket_name.empty()) {
+ cerr << ": error bucket_name is empty" << std::endl;
+ }
+ else {
+ set<int> osd_ids;
+ crush.get_leaves(bucket_name.c_str(), &osd_ids);
+ for (auto &id : osd_ids) {
+ cout << "osd." << id << std::endl;
+ }
+ }
+ }
+
if (dump) {
boost::scoped_ptr<Formatter> f(Formatter::create(dump_format, "json-pretty", "json-pretty"));
f->open_object_section("crush_map");