]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/OSDMonitor: use ANY addr type for blacklisting
authorSage Weil <sage@redhat.com>
Wed, 5 Dec 2018 22:23:12 +0000 (16:23 -0600)
committerSage Weil <sage@redhat.com>
Thu, 3 Jan 2019 17:17:20 +0000 (11:17 -0600)
Client addresses are untyped in that they can connect to v1 or v2 server
endpoints, so blacklist them as TYPE_ANY.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h

index 9f7f176aabe212148f0f12773fb681c5795b0e0c..51cbf07e7b993b8dfdeb90d198d644c4e2bea11f 100644 (file)
@@ -1387,6 +1387,12 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t)
          pending_inc.new_pools[i.first].flags |= pg_pool_t::FLAG_CREATING;
        }
       }
+      // adjust blacklist items to all be TYPE_ANY
+      for (auto& i : tmp.blacklist) {
+       auto a = i.first;
+       a.set_type(entity_addr_t::TYPE_ANY);
+       pending_inc.new_blacklist[a] = i.second;
+      }
     }
   }
 
@@ -4007,14 +4013,24 @@ int OSDMonitor::get_version_full(version_t ver, uint64_t features,
 epoch_t OSDMonitor::blacklist(const entity_addrvec_t& av, utime_t until)
 {
   dout(10) << "blacklist " << av << " until " << until << dendl;
-  for (auto& a : av.v) {
+  for (auto a : av.v) {
+    if (osdmap.require_osd_release >= CEPH_RELEASE_NAUTILUS) {
+      a.set_type(entity_addr_t::TYPE_ANY);
+    } else {
+      a.set_type(entity_addr_t::TYPE_LEGACY);
+    }
     pending_inc.new_blacklist[a] = until;
   }
   return pending_inc.epoch;
 }
 
-epoch_t OSDMonitor::blacklist(const entity_addr_t& a, utime_t until)
+epoch_t OSDMonitor::blacklist(entity_addr_t a, utime_t until)
 {
+  if (osdmap.require_osd_release >= CEPH_RELEASE_NAUTILUS) {
+    a.set_type(entity_addr_t::TYPE_ANY);
+  } else {
+    a.set_type(entity_addr_t::TYPE_LEGACY);
+  }
   dout(10) << "blacklist " << a << " until " << until << dendl;
   pending_inc.new_blacklist[a] = until;
   return pending_inc.epoch;
@@ -11372,6 +11388,13 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
       goto reply;
     }
     else {
+      if (osdmap.require_osd_release >= CEPH_RELEASE_NAUTILUS) {
+       // always blacklist type ANY
+       addr.set_type(entity_addr_t::TYPE_ANY);
+      } else {
+       addr.set_type(entity_addr_t::TYPE_LEGACY);
+      }
+
       string blacklistop;
       cmd_getval(cct, cmdmap, "blacklistop", blacklistop);
       if (blacklistop == "add") {
index 29b1a1065ba9770ee69543b116a32219d88f8b8a..9055ec452602bd9197f3692e02052115aeb84765 100644 (file)
@@ -673,7 +673,7 @@ public:
   int get_full_from_pinned_map(version_t ver, bufferlist& bl);
 
   epoch_t blacklist(const entity_addrvec_t& av, utime_t until);
-  epoch_t blacklist(const entity_addr_t& a, utime_t until);
+  epoch_t blacklist(entity_addr_t a, utime_t until);
 
   void dump_info(Formatter *f);
   int dump_osd_metadata(int osd, Formatter *f, ostream *err);