]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: catch cmd_bad_get for asok hooks
authorSage Weil <sage@redhat.com>
Mon, 13 Aug 2018 18:37:10 +0000 (13:37 -0500)
committerSage Weil <sage@redhat.com>
Sat, 1 Sep 2018 21:38:58 +0000 (16:38 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc

index e3925c0b2b9b3a78da9b010af0197b6be8b625a9..737e2f9c5caa695469e252ef4fde1c3835a7fd7c 100644 (file)
@@ -2007,7 +2007,13 @@ public:
   bool call(std::string_view admin_command, const cmdmap_t& cmdmap,
            std::string_view format, bufferlist& out) override {
     stringstream ss;
-    bool r = osd->asok_command(admin_command, cmdmap, format, ss);
+    bool r = true;
+    try {
+      r = osd->asok_command(admin_command, cmdmap, format, ss);
+    } catch (const bad_cmd_get& e) {
+      ss << e.what();
+      r = true;
+    }
     out.append(ss);
     return r;
   }
@@ -2268,7 +2274,11 @@ public:
   bool call(std::string_view command, const cmdmap_t& cmdmap,
            std::string_view format, bufferlist& out) override {
     stringstream ss;
-    test_ops(service, store, command, cmdmap, ss);
+    try {
+      test_ops(service, store, command, cmdmap, ss);
+    } catch (const bad_cmd_get& e) {
+      ss << e.what();
+    }
     out.append(ss);
     return true;
   }