From: Javeme Date: Wed, 19 Oct 2016 05:51:29 +0000 (+0800) Subject: osd/command tell: check pgid at the right time X-Git-Tag: v11.1.0~469^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ef14b7b760a4adfd7b0f3fe13b12658f3f2a739f;p=ceph.git osd/command tell: check pgid at the right time Run a command: "ceph tell osd.0 query", and it outputs the following error message: Error EINVAL: unrecognized command! [{"prefix": "query"}] In fact, the command "query" exists, but it requires one more input parameter "pgid", therefore the following error information will be more appropriate: Error EINVAL: no pgid specified In this patch, we check the parameter pgid after recognizing a command (like "query" or "list_missing"), rather than before it. Signed-off-by: Javeme --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index d6c37d1aa4ba..e9e97857f999 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -5540,11 +5540,10 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector& cmd, buffe // 'tell ' (which comes in without any of that prefix)? else if (prefix == "pg" || - (cmd_getval(cct, cmdmap, "pgid", pgidstr) && - (prefix == "query" || - prefix == "mark_unfound_lost" || - prefix == "list_missing") - )) { + prefix == "query" || + prefix == "mark_unfound_lost" || + prefix == "list_missing" + ) { pg_t pgid; if (!cmd_getval(cct, cmdmap, "pgid", pgidstr)) {