From: Sage Weil Date: Thu, 23 Feb 2017 21:31:21 +0000 (-0500) Subject: mon/OSDMonitor: set cluster flags based on osd flags (luminous) X-Git-Tag: v12.0.1~145^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=707e43d5ae4767dd5057ac967ce8b84d78d59467;p=ceph.git mon/OSDMonitor: set cluster flags based on osd flags (luminous) For luminous, set cluster flags based on osd flags. Until require_luminous is set, stick with the old pgmap-based behavior. Move the new check to encode_pending so that the cluster flag is set in the same epoch that the osd state(s) change. Signed-off-by: Sage Weil --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 1ef0dd9834cb..ce35491888e0 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -1185,6 +1185,41 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t) bufferlist bl; + // set or clear full/nearfull? + { + OSDMap tmp; + tmp.deepish_copy_from(osdmap); + tmp.apply_incremental(pending_inc); + + if (tmp.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) { + int full, nearfull; + tmp.count_full_nearfull_osds(&full, &nearfull); + if (full > 0) { + if (!tmp.test_flag(CEPH_OSDMAP_FULL)) { + dout(10) << __func__ << " setting full flag" << dendl; + add_flag(CEPH_OSDMAP_FULL); + remove_flag(CEPH_OSDMAP_NEARFULL); + } + } else { + if (tmp.test_flag(CEPH_OSDMAP_FULL)) { + dout(10) << __func__ << " clearing full flag" << dendl; + remove_flag(CEPH_OSDMAP_FULL); + } + if (nearfull > 0) { + if (!tmp.test_flag(CEPH_OSDMAP_NEARFULL)) { + dout(10) << __func__ << " setting nearfull flag" << dendl; + add_flag(CEPH_OSDMAP_NEARFULL); + } + } else { + if (tmp.test_flag(CEPH_OSDMAP_NEARFULL)) { + dout(10) << __func__ << " clearing nearfull flag" << dendl; + remove_flag(CEPH_OSDMAP_NEARFULL); + } + } + } + } + } + // tell me about it for (map::iterator i = pending_inc.new_state.begin(); i != pending_inc.new_state.end(); @@ -3020,8 +3055,10 @@ void OSDMonitor::tick() } } - //if map full setting has changed, get that info out there! - if (mon->pgmon()->is_readable()) { + // if map full setting has changed, get that info out there! + if (!osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS) && + mon->pgmon()->is_readable()) { + // for pre-luminous compat only! if (!mon->pgmon()->pg_map.full_osds.empty()) { dout(5) << "There are full osds, setting full flag" << dendl; add_flag(CEPH_OSDMAP_FULL);