]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "mgr/DaemonServer: safe-to-destroy - do not consider irrelevant pgs" 32203/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 2 Sep 2019 05:34:35 +0000 (13:34 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Thu, 12 Dec 2019 07:45:41 +0000 (15:45 +0800)
This reverts commit ba8dd78236eec2c70b9bdc335d847c5762d4b6d4.

We use OSD device class to separate pools. Hence removing
the device class of an osd may cause mgr mistakenly approve
an invalid safe-to-destroy request, e.g., because that osd now
belongs to no pool while data migration could be still in-progress..

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

index 2fd572ed6a507315902bffbcbefa8d33d9e5c0e8..8af4a1a76b640ee5ea2e5e8e4036f99dcdd177e4 100644 (file)
@@ -1425,33 +1425,6 @@ bool DaemonServer::_handle_command(
            safe_to_destroy.insert(osd);
            continue;  // clearly safe to destroy
          }
-          set<int64_t> pools;
-          osdmap.get_pool_ids_by_osd(g_ceph_context, osd, &pools);
-          if (pools.empty()) {
-            // osd does not belong to any pools yet
-            safe_to_destroy.insert(osd);
-            continue;
-          }
-          if (osdmap.is_down(osd) && osdmap.is_out(osd)) {
-            // if osd is down&out and all relevant pools are active+clean,
-            // then should be safe to destroy
-            bool all_osd_pools_active_clean = true;
-            for (auto &ps: pg_map.pg_stat) {
-              auto& pg = ps.first;
-              auto state = ps.second.state;
-              if (!pools.count(pg.pool()))
-                continue;
-              if ((state & (PG_STATE_ACTIVE | PG_STATE_CLEAN)) !=
-                           (PG_STATE_ACTIVE | PG_STATE_CLEAN)) {
-                all_osd_pools_active_clean = false;
-                break;
-              }
-            }
-            if (all_osd_pools_active_clean) {
-              safe_to_destroy.insert(osd);
-              continue;
-            }
-          }
          auto q = pg_map.num_pg_by_osd.find(osd);
          if (q != pg_map.num_pg_by_osd.end()) {
            if (q->second.acting > 0 || q->second.up_not_acting > 0) {