From ef14b7b760a4adfd7b0f3fe13b12658f3f2a739f Mon Sep 17 00:00:00 2001 From: Javeme Date: Wed, 19 Oct 2016 13:51:29 +0800 Subject: [PATCH] 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 --- src/osd/OSD.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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)) { -- 2.47.3