]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: make error handling for "osd lost" command more fine-grained
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 11 May 2016 08:13:47 +0000 (16:13 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Thu, 28 Jul 2016 08:02:07 +0000 (16:02 +0800)
If the specified osd is not down or doesn't exist, we shall
return error instead of success. So caller can abort(if does not exist)
or mark osd as down and retry(if not down).

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/mon/OSDMonitor.cc

index 7859d2b64d4d1917b26699ab55dd71ef95f082d3..f303db3863d7b5004f43735c21ecf0375c1ce1f0 100644 (file)
@@ -6649,8 +6649,14 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
            "--yes-i-really-mean-it if you really do.";
       err = -EPERM;
       goto reply;
-    } else if (!osdmap.exists(id) || !osdmap.is_down(id)) {
-      ss << "osd." << id << " is not down or doesn't exist";
+    } else if (!osdmap.exists(id)) {
+      ss << "osd." << id << " does not exist";
+      err = -ENOENT;
+      goto reply;
+    } else if (!osdmap.is_down(id)) {
+      ss << "osd." << id << " is not down";
+      err = -EBUSY;
+      goto reply;
     } else {
       epoch_t e = osdmap.get_info(id).down_at;
       pending_inc.new_lost[id] = e;