messages: add cluster_addr to MOSDBoot, use it in OSD and OSDMonitor

This commit is contained in:
Greg Farnum 2010-07-08 15:51:07 -07:00
parent d290a046a5
commit 382290ef2e
3 changed files with 19 additions and 2 deletions

View File

@ -24,12 +24,18 @@ class MOSDBoot : public PaxosServiceMessage {
public:
OSDSuperblock sb;
entity_addr_t hb_addr;
entity_addr_t cluster_addr;
MOSDBoot() : PaxosServiceMessage( MSG_OSD_BOOT, 0){}
MOSDBoot(OSDSuperblock& s, entity_addr_t& hb_addr_ref) :
PaxosServiceMessage(MSG_OSD_BOOT, s.current_epoch),
sb(s), hb_addr(hb_addr_ref) {
sb(s), hb_addr(hb_addr_ref), cluster_addr() {
}
MOSDBoot(OSDSuperblock& s, entity_addr_t& hb_addr_ref,
entity_addr_t& cluster_addr_ref) :
PaxosServiceMessage(MSG_OSD_BOOT, s.current_epoch),
sb(s), hb_addr(hb_addr_ref), cluster_addr(cluster_addr_ref) {}
private:
~MOSDBoot() {}
@ -40,15 +46,19 @@ public:
}
void encode_payload() {
header.version = 1;
paxos_encode();
::encode(sb, payload);
::encode(hb_addr, payload);
::encode(cluster_addr, payload);
}
void decode_payload() {
bufferlist::iterator p = payload.begin();
paxos_decode(p);
::decode(sb, p);
::decode(hb_addr, p);
if (header.version >=1)
::decode(cluster_addr, p);
}
};

View File

@ -482,6 +482,10 @@ bool OSDMonitor::prepare_boot(MOSDBoot *m)
pending_inc.new_up_client[from] = m->get_orig_source_addr(); //FIXME: should this be using new_up_client?
pending_inc.new_hb_up[from] = m->hb_addr;
if (!m->cluster_addr.is_blank_addr()) { //is there a cluster addr?
pending_inc.new_up_internal[from] = m->cluster_addr; //fill it in!
}
// mark in?
pending_inc.new_weight[from] = CEPH_OSD_IN;

View File

@ -1527,7 +1527,10 @@ void OSD::send_boot()
hb_addr = cluster_messenger->get_myaddr();
hb_addr.set_port(port);
}
monc->send_mon_message(new MOSDBoot(superblock, hb_addr));
MOSDBoot *mboot = new MOSDBoot(superblock, hb_addr);
if (cluster_messenger != client_messenger)
mboot->cluster_addr = cluster_messenger->get_myaddr();
monc->send_mon_message(mboot);
}
void OSD::queue_want_up_thru(epoch_t want)