From: Sage Weil Date: Mon, 13 Aug 2018 18:37:10 +0000 (-0500) Subject: osd: catch cmd_bad_get for asok hooks X-Git-Tag: v14.0.1~390^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c254516766f3e2e52de10d9fd4fd67957c42fa68;p=ceph.git osd: catch cmd_bad_get for asok hooks Signed-off-by: Sage Weil --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index e3925c0b2b9b3..737e2f9c5caa6 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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; }