]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: osd find / metadata --format plain fallback
authorNathan Cutler <ncutler@suse.cz>
Wed, 6 May 2015 09:18:50 +0000 (11:18 +0200)
committerNathan Cutler <ncutler@suse.cz>
Wed, 6 May 2015 09:18:50 +0000 (11:18 +0200)
ceph --format plain osd find 1 (and metadata) are not implemented and
must fallback to the default (json-pretty).

http://tracker.ceph.com/issues/9538 Fixes: #9538

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
(cherry picked from commit 13780d7)

Rebased to omit the modifications to qa/workunits/cephtool/test.sh so the patch
will apply to the upstream tarball.

Signed-off-by: Nathan Cutler <ncutler@suse.com>
src/mon/OSDMonitor.cc

index da06b86beb1d49193111ca8ae193d3b33b7c7df3..7edda2964b86dc1397c48c3751e935b8e1e28755 100644 (file)
@@ -2297,6 +2297,8 @@ bool OSDMonitor::preprocess_command(MMonCommand *m)
     string format;
     cmd_getval(g_ceph_context, cmdmap, "format", format, string("json-pretty"));
     boost::scoped_ptr<Formatter> f(new_formatter(format));
+    if (!f)
+      f.reset(new_formatter("json-pretty"));
 
     f->open_object_section("osd_location");
     f->dump_int("osd", osd);
@@ -2324,6 +2326,8 @@ bool OSDMonitor::preprocess_command(MMonCommand *m)
     string format;
     cmd_getval(g_ceph_context, cmdmap, "format", format, string("json-pretty"));
     boost::scoped_ptr<Formatter> f(new_formatter(format));
+    if (!f)
+      f.reset(new_formatter("json-pretty"));
     f->open_object_section("osd_metadata");
     r = dump_osd_metadata(osd, f.get(), &ss);
     if (r < 0)