class Formatter {
public:
static Formatter *create(const std::string& type,
- const std::string& default_type);
+ const std::string& default_type,
+ const std::string& fallback);
+ static Formatter *create(const std::string& type,
+ const std::string& default_type) {
+ return create(type, default_type, "");
+ }
static Formatter *create(const std::string& type) {
- return create(type, "json-pretty");
+ return create(type, "json-pretty", "");
}
Formatter();
goto reply;
}
string format;
- cmd_getval(g_ceph_context, cmdmap, "format", format, string("json-pretty"));
- boost::scoped_ptr<Formatter> f(Formatter::create(format));
+ cmd_getval(g_ceph_context, cmdmap, "format", format);
+ boost::scoped_ptr<Formatter> f(Formatter::create(format, "json-pretty", "json-pretty"));
f->open_object_section("osd_location");
f->dump_int("osd", osd);
f->dump_stream("ip") << osdmap.get_addr(osd);
goto reply;
}
string format;
- cmd_getval(g_ceph_context, cmdmap, "format", format, string("json-pretty"));
- boost::scoped_ptr<Formatter> f(Formatter::create(format));
+ cmd_getval(g_ceph_context, cmdmap, "format", format);
+ boost::scoped_ptr<Formatter> f(Formatter::create(format, "json-pretty", "json-pretty"));
f->open_object_section("osd_metadata");
r = dump_osd_metadata(osd, f.get(), &ss);
if (r < 0)
} else if (prefix == "osd crush rule list" ||
prefix == "osd crush rule ls") {
string format;
- cmd_getval(g_ceph_context, cmdmap, "format", format, string("json-pretty"));
- boost::scoped_ptr<Formatter> f(Formatter::create(format));
+ cmd_getval(g_ceph_context, cmdmap, "format", format);
+ boost::scoped_ptr<Formatter> f(Formatter::create(format, "json-pretty", "json-pretty"));
f->open_array_section("rules");
osdmap.crush->list_rules(f.get());
f->close_section();
string name;
cmd_getval(g_ceph_context, cmdmap, "name", name);
string format;
- cmd_getval(g_ceph_context, cmdmap, "format", format, string("json-pretty"));
- boost::scoped_ptr<Formatter> f(Formatter::create(format));
+ cmd_getval(g_ceph_context, cmdmap, "format", format);
+ boost::scoped_ptr<Formatter> f(Formatter::create(format, "json-pretty", "json-pretty"));
if (name == "") {
f->open_array_section("rules");
osdmap.crush->dump_rules(f.get());
rdata.append(rs.str());
} else if (prefix == "osd crush dump") {
string format;
- cmd_getval(g_ceph_context, cmdmap, "format", format, string("json-pretty"));
- boost::scoped_ptr<Formatter> f(Formatter::create(format));
+ cmd_getval(g_ceph_context, cmdmap, "format", format);
+ boost::scoped_ptr<Formatter> f(Formatter::create(format, "json-pretty", "json-pretty"));
f->open_object_section("crush_map");
osdmap.crush->dump(f.get());
f->close_section();
rdata.append(rs.str());
} else if (prefix == "osd crush show-tunables") {
string format;
- cmd_getval(g_ceph_context, cmdmap, "format", format, string("json-pretty"));
- boost::scoped_ptr<Formatter> f(Formatter::create(format));
+ cmd_getval(g_ceph_context, cmdmap, "format", format);
+ boost::scoped_ptr<Formatter> f(Formatter::create(format, "json-pretty", "json-pretty"));
f->open_object_section("crush_map_tunables");
osdmap.crush->dump_tunables(f.get());
f->close_section();