prefix == "osd crush rule ls") {
string format;
cmd_getval(g_ceph_context, cmdmap, "format", format, string("json-pretty"));
- boost::scoped_ptr<Formatter> f(new_formatter(format));
+ Formatter *fp = new_formatter(format);
+ if (!fp)
+ fp = new_formatter("json-pretty");
+ boost::scoped_ptr<Formatter> f(fp);
f->open_array_section("rules");
osdmap.crush->list_rules(f.get());
f->close_section();
} else if (prefix == "osd crush rule dump") {
string format;
cmd_getval(g_ceph_context, cmdmap, "format", format, string("json-pretty"));
- boost::scoped_ptr<Formatter> f(new_formatter(format));
+ Formatter *fp = new_formatter(format);
+ if (!fp)
+ fp = new_formatter("json-pretty");
+ boost::scoped_ptr<Formatter> f(fp);
f->open_array_section("rules");
osdmap.crush->dump_rules(f.get());
f->close_section();
} else if (prefix == "osd crush dump") {
string format;
cmd_getval(g_ceph_context, cmdmap, "format", format, string("json-pretty"));
- boost::scoped_ptr<Formatter> f(new_formatter(format));
+ Formatter *fp = new_formatter(format);
+ if (!fp)
+ fp = new_formatter("json-pretty");
+ boost::scoped_ptr<Formatter> f(fp);
f->open_object_section("crush_map");
osdmap.crush->dump(f.get());
f->close_section();