From 85131220c83de0debd238031f3d86497ef62c1c2 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 3 May 2011 12:37:33 -0700 Subject: [PATCH] mon: add 'ceph osd rm N...' command So we can mark an old osd as deleted and have it not appear in the osdmap dump, summary count. Signed-off-by: Sage Weil --- src/mon/OSDMonitor.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index d25569e370fa5..a94ae07bcc7a2 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -1530,6 +1530,29 @@ bool OSDMonitor::prepare_command(MMonCommand *m) return true; } } + else if (m->cmd[1] == "rm" && m->cmd.size() >= 3) { + bool any = false; + for (unsigned j = 2; j < m->cmd.size(); j++) { + long osd = strtol(m->cmd[2].c_str(), 0, 10); + if (!osdmap.exists(osd)) { + ss << "osd" << osd << " does not exist"; + } else if (osdmap.is_up(osd)) { + ss << "osd" << osd << " is still up"; + } else { + pending_inc.new_state[osd] = CEPH_OSD_EXISTS; + if (any) + ss << ", osd" << osd; + else + ss << "marked dne osd" << osd; + any = true; + } + } + if (any) { + getline(ss, rs); + paxos->wait_for_commit(new Monitor::C_Command(mon, m, 0, rs, paxos->get_version())); + return true; + } + } else if (m->cmd[1] == "blacklist" && m->cmd.size() >= 4) { entity_addr_t addr; if (!addr.parse(m->cmd[3].c_str(), 0)) -- 2.39.5