osd: send correct ip addrs to monitor for cluster_, hb_addr

Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
Sage Weil 2010-11-21 20:48:49 -08:00
parent 2031364451
commit 28498a00cf
3 changed files with 20 additions and 18 deletions

View File

@ -212,15 +212,12 @@ int main(int argc, const char **argv)
SimpleMessenger *cluster_messenger = new SimpleMessenger();
SimpleMessenger *messenger_hb = new SimpleMessenger();
entity_addr_t hb_addr;
if (client_addr_set) {
if (client_addr_set)
client_messenger->bind(g_conf.public_addr);
hb_addr = g_conf.public_addr;
hb_addr.set_port(0);
} else {
else
client_messenger->bind();
}
entity_addr_t hb_addr; // hb should bind to same ip ad cluster_addr (if specified)
if (cluster_addr_set) {
cluster_messenger->bind(g_conf.cluster_addr);

View File

@ -27,11 +27,8 @@ class MOSDBoot : public PaxosServiceMessage {
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), cluster_addr() { }
MOSDBoot(OSDSuperblock& s, entity_addr_t& hb_addr_ref,
entity_addr_t& cluster_addr_ref) :
MOSDBoot(OSDSuperblock& s, const entity_addr_t& hb_addr_ref,
const 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) { }

View File

@ -1594,17 +1594,25 @@ void OSD::ms_handle_connect(Connection *con)
void OSD::send_boot()
{
dout(10) << "send_boot" << dendl;
entity_addr_t cluster_addr = cluster_messenger->get_myaddr();
if (cluster_addr.is_blank_addr()) {
int port = cluster_addr.get_port();
cluster_addr = client_messenger->get_myaddr();
cluster_addr.set_port(port);
dout(10) << " assuming cluster_addr ip matches client_addr" << dendl;
}
entity_addr_t hb_addr = heartbeat_messenger->get_myaddr();
if (hb_addr.is_blank_addr()) {
int port = hb_addr.get_port();
hb_addr = cluster_messenger->get_myaddr();
hb_addr = cluster_addr;
hb_addr.set_port(port);
dout(10) << " assuming hb_addr ip matches cluster_addr" << dendl;
}
MOSDBoot *mboot = new MOSDBoot(superblock, hb_addr);
mboot->cluster_addr = cluster_messenger->get_myaddr();
dout(0) << "setting MOSDBoot->cluster_addr to" << cluster_messenger->get_myaddr()
<< " while client_messenger addr is " << client_messenger->get_myaddr() << dendl;
MOSDBoot *mboot = new MOSDBoot(superblock, hb_addr, cluster_addr);
dout(10) << " client_addr " << client_messenger->get_myaddr()
<< ", cluster_addr " << cluster_addr
<< ", hb addr " << hb_addr
<< dendl;
monc->send_mon_message(mboot);
}