]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/command tell: check pgid at the right time 11547/head
authorJaveme <javaloveme@gmail.com>
Wed, 19 Oct 2016 05:51:29 +0000 (13:51 +0800)
committerJaveme <javaloveme@gmail.com>
Fri, 21 Oct 2016 10:23:56 +0000 (18:23 +0800)
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 <javaloveme@gmail.com>
src/osd/OSD.cc

index d6c37d1aa4baac64708e55f81160345af10a3d63..e9e97857f99938807577f8292397260ca75a1435 100644 (file)
@@ -5540,11 +5540,10 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
   // 'tell <pgid>' (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)) {