Merge pull request #27426 from tchaikov/wip-crimson-setup-msgr

crimson/osd: consolidate the code to initialize msgrs

Reviewed-by: Samuel Just <sjust@redhat.com>
Reviewed-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
This commit is contained in:
Kefu Chai 2019-04-09 11:31:19 +08:00 committed by GitHub
commit a866d16095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 19 deletions

View File

@ -59,12 +59,6 @@ seastar::future<>
Heartbeat::start_messenger(ceph::net::Messenger& msgr,
const entity_addrvec_t& addrs)
{
if (local_conf()->ms_crc_data) {
msgr.set_crc_data();
}
if (local_conf()->ms_crc_header) {
msgr.set_crc_header();
}
return msgr.try_bind(addrs,
local_conf()->ms_bind_port_min,
local_conf()->ms_bind_port_max).then([&msgr, this] {

View File

@ -101,11 +101,19 @@ int main(int argc, char* argv[])
local_conf().parse_argv(ceph_args).get();
const int whoami = std::stoi(local_conf()->name.get_id());
const auto nonce = static_cast<uint32_t>(getpid());
const auto shard = seastar::engine().cpu_id();
cluster_msgr.start(entity_name_t::OSD(whoami), "cluster"s, nonce, shard).get();
client_msgr.start(entity_name_t::OSD(whoami), "client"s, nonce, shard).get();
hb_front_msgr.start(entity_name_t::OSD(whoami), "hb_front"s, nonce, shard).get();
hb_back_msgr.start(entity_name_t::OSD(whoami), "hb_back"s, nonce, shard).get();
for (auto [msgr, name] : {make_pair(std::ref(cluster_msgr), "cluster"s),
make_pair(std::ref(client_msgr), "client"s),
make_pair(std::ref(hb_front_msgr), "hb_front"s),
make_pair(std::ref(hb_back_msgr), "hb_back"s)}) {
const auto shard = seastar::engine().cpu_id();
msgr.start(entity_name_t::OSD(whoami), name, nonce, shard).get();
if (local_conf()->ms_crc_data) {
msgr.local().set_crc_data();
}
if (local_conf()->ms_crc_header) {
msgr.local().set_crc_header();
}
}
osd.start_single(whoami, nonce,
reference_wrapper<ceph::net::Messenger>(cluster_msgr.local()),
reference_wrapper<ceph::net::Messenger>(client_msgr.local()),

View File

@ -185,14 +185,6 @@ seastar::future<> OSD::start()
osdmap = std::move(map);
return load_pgs();
}).then([this] {
for (auto msgr : {std::ref(cluster_msgr), std::ref(public_msgr)}) {
if (local_conf()->ms_crc_data) {
msgr.get().set_crc_data();
}
if (local_conf()->ms_crc_header) {
msgr.get().set_crc_header();
}
}
dispatchers.push_front(this);
dispatchers.push_front(monc.get());
dispatchers.push_front(mgrc.get());