From: Sage Weil Date: Sat, 9 Nov 2013 14:05:59 +0000 (-0800) Subject: mon/OSDMonitor: record osd metadata key/value info X-Git-Tag: v0.74~37^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ea164352f7ff63ba9cda51aabb0bdf7b8c80e3d4;p=ceph.git mon/OSDMonitor: record osd metadata key/value info Shove what the OSD gives us on boot into the store. Signed-off-by: Sage Weil --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 2c17cca85b7..1967660bd1f 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -591,6 +591,18 @@ void OSDMonitor::encode_pending(MonitorDBStore::Transaction *t) /* put everything in the transaction */ put_version(t, pending_inc.epoch, bl); put_last_committed(t, pending_inc.epoch); + + // metadata, too! + for (map::iterator p = pending_metadata.begin(); + p != pending_metadata.end(); + ++p) + t->put(OSD_METADATA_PREFIX, stringify(p->first), p->second); + for (set::iterator p = pending_metadata_rm.begin(); + p != pending_metadata_rm.end(); + ++p) + t->erase(OSD_METADATA_PREFIX, stringify(*p)); + pending_metadata.clear(); + pending_metadata_rm.clear(); } void OSDMonitor::share_map_with_random_osd() @@ -1266,6 +1278,11 @@ bool OSDMonitor::prepare_boot(MOSDBoot *m) } } + // metadata + bufferlist osd_metadata; + ::encode(m->metadata, osd_metadata); + pending_metadata[from] = osd_metadata; + // adjust last clean unmount epoch? const osd_info_t& info = osdmap.get_info(from); dout(10) << " old osd_info: " << info << dendl; @@ -3500,6 +3517,7 @@ bool OSDMonitor::prepare_command(MMonCommand *m) } else { pending_inc.new_state[osd] = osdmap.get_state(osd); pending_inc.new_uuid[osd] = uuid_d(); + pending_metadata_rm.insert(osd); if (any) { ss << ", osd." << osd; } else { diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index 25a2061a8eb..7ea9dc3f804 100644 --- a/src/mon/OSDMonitor.h +++ b/src/mon/OSDMonitor.h @@ -37,6 +37,8 @@ class Monitor; #include "messages/MOSDFailure.h" #include "messages/MPoolOp.h" +#define OSD_METADATA_PREFIX "osd_metadata" + /// information about a particular peer's failure reports for one osd struct failure_reporter_t { int num_reports; ///< reports from this reporter @@ -120,6 +122,8 @@ public: private: // [leader] OSDMap::Incremental pending_inc; + map pending_metadata; + set pending_metadata_rm; map failure_info; map down_pending_out; // osd down -> out