Skip to content

Commit

Permalink
Merge pull request #13329 from Adirl/fix_febe
Browse files Browse the repository at this point in the history
msg: Fix calls to Messenger::create with new parameter

Reviewed-by: Haomai Wang <haomai@xsky.com>
  • Loading branch information
liewegas committed Feb 10, 2017
2 parents 602278d + 2069427 commit e9b3f16
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/mgr/DaemonServer.cc
Expand Up @@ -46,7 +46,8 @@ DaemonServer::~DaemonServer() {
int DaemonServer::init(uint64_t gid, entity_addr_t client_addr)
{
// Initialize Messenger
msgr = Messenger::create(g_ceph_context, g_conf->ms_type,
std::string public_msgr_type = g_conf->ms_public_type.empty() ? g_conf->ms_type : g_conf->ms_public_type;
msgr = Messenger::create(g_ceph_context, public_msgr_type,
entity_name_t::MGR(gid), "server", getpid(), 0);
int r = msgr->bind(g_conf->public_addr);
if (r < 0) {
Expand Down
3 changes: 2 additions & 1 deletion src/test/mon/test-mon-msg.cc
Expand Up @@ -79,7 +79,8 @@ class MonClientHelper : public Dispatcher
int init_messenger() {
dout(1) << __func__ << dendl;

msg = Messenger::create(cct, cct->_conf->ms_type, entity_name_t::CLIENT(-1),
std::string public_msgr_type = cct->_conf->ms_public_type.empty() ? cct->_conf->ms_type : cct->_conf->ms_public_type;
msg = Messenger::create(cct, public_msgr_type, entity_name_t::CLIENT(-1),
"test-mon-msg", 0, 0);
assert(msg != NULL);
msg->set_default_policy(Messenger::Policy::lossy_client(0,0));
Expand Down
3 changes: 2 additions & 1 deletion src/test/mon/test_mon_workloadgen.cc
Expand Up @@ -361,7 +361,8 @@ class OSDStub : public TestStub
<< cct->_conf->auth_supported << dendl;
stringstream ss;
ss << "client-osd" << whoami;
messenger.reset(Messenger::create(cct, cct->_conf->ms_type, entity_name_t::OSD(whoami),
std::string public_msgr_type = cct->_conf->ms_public_type.empty() ? cct->_conf->ms_type : cct->_conf->ms_public_type;
messenger.reset(Messenger::create(cct, public_msgr_type, entity_name_t::OSD(whoami),
ss.str().c_str(), getpid(), 0));

Throttle throttler(g_ceph_context, "osd_client_bytes",
Expand Down
8 changes: 6 additions & 2 deletions src/test/msgr/perf_msgr_client.cc
Expand Up @@ -189,14 +189,18 @@ int main(int argc, char **argv)
int think_time = atoi(args[4]);
int len = atoi(args[5]);

cerr << " using ms-type " << g_ceph_context->_conf->ms_type << std::endl;
std::string public_msgr_type = g_ceph_context->_conf->ms_public_type.empty() ? g_ceph_context->_conf->ms_type : g_ceph_context->_conf->ms_public_type;

cerr << " using ms-public-type " << public_msgr_type << std::endl;
cerr << " server ip:port " << args[0] << std::endl;
cerr << " numjobs " << numjobs << std::endl;
cerr << " concurrency " << concurrent << std::endl;
cerr << " ios " << ios << std::endl;
cerr << " thinktime(us) " << think_time << std::endl;
cerr << " message data bytes " << len << std::endl;
MessengerClient client(g_ceph_context->_conf->ms_type, args[0], think_time);

MessengerClient client(public_msgr_type, args[0], think_time);

client.ready(concurrent, numjobs, ios, len);
Cycles::init();
uint64_t start = Cycles::rdtsc();
Expand Down
6 changes: 4 additions & 2 deletions src/test/msgr/perf_msgr_server.cc
Expand Up @@ -157,15 +157,17 @@ int main(int argc, char **argv)

int worker_threads = atoi(args[1]);
int think_time = atoi(args[2]);
std::string public_msgr_type = g_ceph_context->_conf->ms_public_type.empty() ? g_ceph_context->_conf->ms_type : g_ceph_context->_conf->ms_public_type;

cerr << " This tool won't handle connection error alike things, " << std::endl;
cerr << "please ensure the proper network environment to test." << std::endl;
cerr << " Or ctrl+c when meeting error and restart tests" << std::endl;
cerr << " using ms-type " << g_ceph_context->_conf->ms_type << std::endl;
cerr << " using ms-public-type " << public_msgr_type << std::endl;
cerr << " bind ip:port " << args[0] << std::endl;
cerr << " worker threads " << worker_threads << std::endl;
cerr << " thinktime(us) " << think_time << std::endl;

MessengerServer server(g_ceph_context->_conf->ms_type, args[0], worker_threads, think_time);
MessengerServer server(public_msgr_type, args[0], worker_threads, think_time);
server.start();

return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/test/msgr/test_msgr.cc
Expand Up @@ -1498,7 +1498,7 @@ INSTANTIATE_TEST_CASE_P(
Messenger,
MessengerTest,
::testing::Values(
"async",
"async+posix",
"simple"
)
);
Expand Down
3 changes: 2 additions & 1 deletion src/test/osd/TestOSDScrub.cc
Expand Up @@ -56,7 +56,8 @@ TEST(TestOSDScrub, scrub_time_permit) {
g_conf->osd_objectstore,
g_conf->osd_data,
g_conf->osd_journal);
Messenger *ms = Messenger::create(g_ceph_context, g_conf->ms_type,
std::string cluster_msgr_type = g_conf->ms_cluster_type.empty() ? g_conf->ms_type : g_conf->ms_cluster_type;
Messenger *ms = Messenger::create(g_ceph_context, cluster_msgr_type,
entity_name_t::OSD(0), "make_checker",
getpid(), 0);
ms->set_cluster_protocol(CEPH_OSD_PROTOCOL);
Expand Down
3 changes: 2 additions & 1 deletion src/test/testmsgr.cc
Expand Up @@ -92,8 +92,9 @@ int main(int argc, const char **argv, const char *envp[]) {
std::string sss(ss.str());
g_ceph_context->_conf->set_val("public_addr", sss.c_str());
g_ceph_context->_conf->apply_changes(NULL);
std::string public_msgr_type = g_conf->ms_public_type.empty() ? g_conf->ms_type : g_conf->ms_public_type;
Messenger *rank = Messenger::create(g_ceph_context,
g_conf->ms_type,
public_msgr_type,
entity_name_t::MON(whoami), "tester",
getpid());
int err = rank->bind(g_ceph_context->_conf->public_addr);
Expand Down

0 comments on commit e9b3f16

Please sign in to comment.