]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/OSDMonitor: make per-OSD no{out,down,in,out} flags prior to CRUSH nodes
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 23 Apr 2019 03:03:04 +0000 (11:03 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 23 Apr 2019 04:40:50 +0000 (12:40 +0800)
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 <xie.xingguo@zte.com.cn>
src/mon/OSDMonitor.cc

index ecbb5cd27113bb62b596d2fdf403613d474eadde..e913c64a00f9115556098589065f1911636846d8 100644 (file)
@@ -10582,11 +10582,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]
@@ -10796,11 +10796,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]