]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/OSDMonitor: another dedup case for pg-upmap-items
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 12 Jul 2017 02:23:21 +0000 (10:23 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Sat, 15 Jul 2017 04:29:57 +0000 (12:29 +0800)
./bin/ceph osd pg-upmap-items 1.0 1 2 1 2
osd.1 -> osd.2 already exists, set 1.0 pg_upmap_items mapping to [1->2]

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

index 4a613ae8843bc85ac0d7c8db72d620c2ff0d82a5..93194e097ac150519b258e456e615b734d253a36 100644 (file)
@@ -9110,7 +9110,14 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
             err = -ENOENT;
             goto reply;
           }
-          new_pg_upmap_items.push_back(make_pair(from, to));
+          pair<int32_t,int32_t> entry = make_pair(from, to);
+          auto it = std::find(new_pg_upmap_items.begin(),
+            new_pg_upmap_items.end(), entry);
+          if (it != new_pg_upmap_items.end()) {
+            ss << "osd." << from << " -> osd." << to << " already exists, ";
+            continue;
+          }
+          new_pg_upmap_items.push_back(entry);
           items << from << "->" << to << ",";
         }
         string out(items.str());