From: xie xingguo Date: Wed, 11 May 2016 08:13:47 +0000 (+0800) Subject: mon/OSDMonitor: make error handling for "osd lost" command more fine-grained X-Git-Tag: ses5-milestone5~206^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3f36408010f81e1468b5fee7c9ded46d04ef8746;p=ceph.git mon/OSDMonitor: make error handling for "osd lost" command more fine-grained 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 --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 7859d2b64d4d..f303db3863d7 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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;