From f55f055661270875ac3b7b388803a1cb422c82b7 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Tue, 23 Apr 2019 11:03:04 +0800 Subject: [PATCH] mon/OSDMonitor: make per-OSD no{out,down,in,out} flags prior to CRUSH nodes This way we 'll be more compatible with older versions, and can effectively reduce the map size for large clusters. Signed-off-by: xie xingguo (cherry picked from commit 01916b99c3a8cb58686963e6167bd46c0d24f218) --- src/mon/OSDMonitor.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 74e27a8bbdc7d..88693b09ad2f0 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -10560,11 +10560,11 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, osdmap.get_all_osds(osds); stop = true; } else { - if (osdmap.crush->name_exists(idvec[j])) { + if (long osd = parse_osd_id(idvec[j].c_str(), &ss); osd >= 0) { + osds.insert(osd); + } else if (osdmap.crush->name_exists(idvec[j])) { + std::stringstream().swap(ss); crush_nodes.insert(osdmap.crush->get_item_id(idvec[j])); - } else if (long osd = parse_osd_id(idvec[j].c_str(), &ss); - osd >= 0) { - osds.insert(osd); } else { // ss has reason for failure ss << ", unable to parse osd id or crush node:\"" << idvec[j] @@ -10754,11 +10754,11 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, stop = true; } else { - if (osdmap.crush->name_exists(idvec[j])) { - crush_nodes.insert(osdmap.crush->get_item_id(idvec[j])); - } else if (long osd = parse_osd_id(idvec[j].c_str(), &ss); - osd >= 0) { + if (long osd = parse_osd_id(idvec[j].c_str(), &ss); osd >= 0) { osds.push_back(osd); + } else if (osdmap.crush->name_exists(idvec[j])) { + std::stringstream().swap(ss); + crush_nodes.insert(osdmap.crush->get_item_id(idvec[j])); } else { // ss has reason for failure ss << ", unable to parse osd id or crush node:\"" << idvec[j] -- 2.39.5