From: Joao Eduardo Luis Date: Thu, 12 Dec 2013 17:58:17 +0000 (+0000) Subject: mon: OSDMonitor: handle osd features on boot X-Git-Tag: v0.75~67^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8ac84db050a6d795297f87d28d00eaa618c34946;p=ceph.git mon: OSDMonitor: handle osd features on boot Add the osd's features to the osd's extra info field in the OSDMap so we can track which OSDs are able to deal with Erasure Codes. This will allow us to decide whether or not we are ready to set EC whenever the user asks us to set EC on a pool -- which shall be handled by a subsequent commit. Fixes: 6028 Signed-off-by: Joao Eduardo Luis --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 35cb4fae261b..d2bde25a46d1 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -1182,6 +1182,15 @@ bool OSDMonitor::preprocess_boot(MOSDBoot *m) } assert(m->get_orig_source_inst().name.is_osd()); + + // check if osd has required features to boot + if ((osdmap.get_features(NULL) & CEPH_FEATURE_OSD_ERASURE_CODES) && + !(m->get_connection()->get_features() & CEPH_FEATURE_OSD_ERASURE_CODES)) { + dout(0) << __func__ << " osdmap requires Erasure Codes but osd at " + << m->get_orig_source_inst() + << " doesn't announce support -- ignore" << dendl; + goto ignore; + } // already booted? if (osdmap.is_up(from) && @@ -1228,7 +1237,7 @@ bool OSDMonitor::prepare_boot(MOSDBoot *m) assert(m->get_orig_source().is_osd()); int from = m->get_orig_source().num(); - + // does this osd exist? if (from >= osdmap.get_max_osd()) { dout(1) << "boot from osd." << from << " >= max_osd " << osdmap.get_max_osd() << dendl; @@ -1337,6 +1346,8 @@ bool OSDMonitor::prepare_boot(MOSDBoot *m) xi.laggy_probability * (1.0 - g_conf->mon_osd_laggy_weight); dout(10) << " laggy, now xi " << xi << dendl; } + // set features shared by the osd + xi.features = m->get_connection()->get_features(); pending_inc.new_xinfo[from] = xi; // wait