summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorliuchang0812 <liuchang0812@gmail.com>2017-03-21 14:53:41 +0100
committerliuchang0812 <liuchang0812@gmail.com>2017-03-22 13:39:51 +0100
commite6755fa59678553b6b62cc4c05fd53177b179c76 (patch)
tree163cb24512557affc1ec54b1c4b2addf38cdf8f4 /src
parentos/bluestore: convert rocksdb_db_paths to SAFE_OPTION (diff)
downloadceph-e6755fa59678553b6b62cc4c05fd53177b179c76.tar.xz
ceph-e6755fa59678553b6b62cc4c05fd53177b179c76.zip
common: convert ms_type option to SAFE_OPTION
We need to modify ms_type in unittest. That use SAFE_OPTION to declare ms_type is safer than pass `safe=false` to set_val. Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/ceph_mds.cc2
-rw-r--r--src/ceph_mon.cc2
-rw-r--r--src/ceph_osd.cc4
-rw-r--r--src/common/config_opts.h2
-rw-r--r--src/mgr/DaemonServer.cc2
-rw-r--r--src/msg/Messenger.cc2
-rw-r--r--src/test/messenger/simple_client.cc2
-rw-r--r--src/test/messenger/simple_server.cc2
-rw-r--r--src/test/mon/test-mon-msg.cc2
-rw-r--r--src/test/mon/test_mon_workloadgen.cc2
-rw-r--r--src/test/msgr/perf_msgr_client.cc2
-rw-r--r--src/test/msgr/perf_msgr_server.cc2
-rw-r--r--src/test/osd/TestOSDScrub.cc2
-rw-r--r--src/test/testmsgr.cc2
14 files changed, 15 insertions, 15 deletions
diff --git a/src/ceph_mds.cc b/src/ceph_mds.cc
index 95fa6d8a151..58c57b13879 100644
--- a/src/ceph_mds.cc
+++ b/src/ceph_mds.cc
@@ -143,7 +143,7 @@ int main(int argc, const char **argv)
uint64_t nonce = 0;
get_random_bytes((char*)&nonce, sizeof(nonce));
- std::string public_msgr_type = g_conf->ms_public_type.empty() ? g_conf->ms_type : g_conf->ms_public_type;
+ std::string public_msgr_type = g_conf->ms_public_type.empty() ? g_conf->get_val<std::string>("ms_type") : g_conf->ms_public_type;
Messenger *msgr = Messenger::create(g_ceph_context, public_msgr_type,
entity_name_t::MDS(-1), "mds",
nonce, Messenger::HAS_MANY_CONNECTIONS);
diff --git a/src/ceph_mon.cc b/src/ceph_mon.cc
index 9c9460cc2b8..0ee2b170bfb 100644
--- a/src/ceph_mon.cc
+++ b/src/ceph_mon.cc
@@ -651,7 +651,7 @@ int main(int argc, const char **argv)
// bind
int rank = monmap.get_rank(g_conf->name.get_id());
- std::string public_msgr_type = g_conf->ms_public_type.empty() ? g_conf->ms_type : g_conf->ms_public_type;
+ std::string public_msgr_type = g_conf->ms_public_type.empty() ? g_conf->get_val<std::string>("ms_type") : g_conf->ms_public_type;
Messenger *msgr = Messenger::create(g_ceph_context, public_msgr_type,
entity_name_t::MON(rank), "mon",
0, Messenger::HAS_MANY_CONNECTIONS);
diff --git a/src/ceph_osd.cc b/src/ceph_osd.cc
index d405de23e21..6971b1a6dfe 100644
--- a/src/ceph_osd.cc
+++ b/src/ceph_osd.cc
@@ -442,8 +442,8 @@ flushjournal_out:
<< TEXT_NORMAL << dendl;
}
- std::string public_msgr_type = g_conf->ms_public_type.empty() ? g_conf->ms_type : g_conf->ms_public_type;
- std::string cluster_msgr_type = g_conf->ms_cluster_type.empty() ? g_conf->ms_type : g_conf->ms_cluster_type;
+ std::string public_msgr_type = g_conf->ms_public_type.empty() ? g_conf->get_val<std::string>("ms_type") : g_conf->ms_public_type;
+ std::string cluster_msgr_type = g_conf->ms_cluster_type.empty() ? g_conf->get_val<std::string>("ms_type") : g_conf->ms_cluster_type;
Messenger *ms_public = Messenger::create(g_ceph_context, public_msgr_type,
entity_name_t::OSD(whoami), "client",
getpid(),
diff --git a/src/common/config_opts.h b/src/common/config_opts.h
index 17729673863..3e6507245c8 100644
--- a/src/common/config_opts.h
+++ b/src/common/config_opts.h
@@ -175,7 +175,7 @@ OPTION(heartbeat_file, OPT_STR, "")
OPTION(heartbeat_inject_failure, OPT_INT, 0) // force an unhealthy heartbeat for N seconds
OPTION(perf, OPT_BOOL, true) // enable internal perf counters
-OPTION(ms_type, OPT_STR, "async+posix") // messenger backend
+SAFE_OPTION(ms_type, OPT_STR, "async+posix") // messenger backend. It will be modified in runtime, so use SAFE_OPTION
OPTION(ms_public_type, OPT_STR, "") // messenger backend
OPTION(ms_cluster_type, OPT_STR, "") // messenger backend
OPTION(ms_tcp_nodelay, OPT_BOOL, true)
diff --git a/src/mgr/DaemonServer.cc b/src/mgr/DaemonServer.cc
index c2243bfee09..10f70004811 100644
--- a/src/mgr/DaemonServer.cc
+++ b/src/mgr/DaemonServer.cc
@@ -48,7 +48,7 @@ DaemonServer::~DaemonServer() {
int DaemonServer::init(uint64_t gid, entity_addr_t client_addr)
{
// Initialize Messenger
- std::string public_msgr_type = g_conf->ms_public_type.empty() ? g_conf->ms_type : g_conf->ms_public_type;
+ std::string public_msgr_type = g_conf->ms_public_type.empty() ? g_conf->get_val<std::string>("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);
diff --git a/src/msg/Messenger.cc b/src/msg/Messenger.cc
index ff9812e3261..ca00e0bb5ca 100644
--- a/src/msg/Messenger.cc
+++ b/src/msg/Messenger.cc
@@ -14,7 +14,7 @@
Messenger *Messenger::create_client_messenger(CephContext *cct, string lname)
{
- std::string public_msgr_type = cct->_conf->ms_public_type.empty() ? cct->_conf->ms_type : cct->_conf->ms_public_type;
+ std::string public_msgr_type = cct->_conf->ms_public_type.empty() ? cct->_conf->get_val<std::string>("ms_type") : cct->_conf->ms_public_type;
uint64_t nonce = 0;
get_random_bytes((char*)&nonce, sizeof(nonce));
return Messenger::create(cct, public_msgr_type, entity_name_t::CLIENT(),
diff --git a/src/test/messenger/simple_client.cc b/src/test/messenger/simple_client.cc
index 7b37921b04f..e85c73e4230 100644
--- a/src/test/messenger/simple_client.cc
+++ b/src/test/messenger/simple_client.cc
@@ -103,7 +103,7 @@ int main(int argc, const char **argv)
"initial msgs (pipe depth) " << n_msgs << " " <<
"data buffer size " << n_dsize << std::endl;
- messenger = Messenger::create(g_ceph_context, g_conf->ms_type,
+ messenger = Messenger::create(g_ceph_context, g_conf->get_val<std::string>("ms_type"),
entity_name_t::MON(-1),
"client",
getpid(), 0);
diff --git a/src/test/messenger/simple_server.cc b/src/test/messenger/simple_server.cc
index a10cdc5472c..34277d513ff 100644
--- a/src/test/messenger/simple_server.cc
+++ b/src/test/messenger/simple_server.cc
@@ -74,7 +74,7 @@ int main(int argc, const char **argv)
dest_str += port;
entity_addr_from_url(&bind_addr, dest_str.c_str());
- messenger = Messenger::create(g_ceph_context, g_conf->ms_type,
+ messenger = Messenger::create(g_ceph_context, g_conf->get_val<std::string>("ms_type"),
entity_name_t::MON(-1),
"simple_server",
0 /* nonce */,
diff --git a/src/test/mon/test-mon-msg.cc b/src/test/mon/test-mon-msg.cc
index 922abea87ce..f5d001043a5 100644
--- a/src/test/mon/test-mon-msg.cc
+++ b/src/test/mon/test-mon-msg.cc
@@ -79,7 +79,7 @@ public:
int init_messenger() {
dout(1) << __func__ << dendl;
- std::string public_msgr_type = cct->_conf->ms_public_type.empty() ? cct->_conf->ms_type : cct->_conf->ms_public_type;
+ std::string public_msgr_type = cct->_conf->ms_public_type.empty() ? cct->_conf->get_val<std::string>("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);
diff --git a/src/test/mon/test_mon_workloadgen.cc b/src/test/mon/test_mon_workloadgen.cc
index c9cba519659..05df8e44db0 100644
--- a/src/test/mon/test_mon_workloadgen.cc
+++ b/src/test/mon/test_mon_workloadgen.cc
@@ -361,7 +361,7 @@ class OSDStub : public TestStub
<< cct->_conf->auth_supported << dendl;
stringstream ss;
ss << "client-osd" << whoami;
- std::string public_msgr_type = cct->_conf->ms_public_type.empty() ? cct->_conf->ms_type : cct->_conf->ms_public_type;
+ std::string public_msgr_type = cct->_conf->ms_public_type.empty() ? cct->_conf->get_val<std::string>("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));
diff --git a/src/test/msgr/perf_msgr_client.cc b/src/test/msgr/perf_msgr_client.cc
index 96488507661..5bb20715c1a 100644
--- a/src/test/msgr/perf_msgr_client.cc
+++ b/src/test/msgr/perf_msgr_client.cc
@@ -192,7 +192,7 @@ int main(int argc, char **argv)
int think_time = atoi(args[4]);
int len = atoi(args[5]);
- 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;
+ std::string public_msgr_type = g_ceph_context->_conf->ms_public_type.empty() ? g_ceph_context->_conf->get_val<std::string>("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;
diff --git a/src/test/msgr/perf_msgr_server.cc b/src/test/msgr/perf_msgr_server.cc
index 9ab4b286d0c..c687d77a649 100644
--- a/src/test/msgr/perf_msgr_server.cc
+++ b/src/test/msgr/perf_msgr_server.cc
@@ -157,7 +157,7 @@ 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;
+ std::string public_msgr_type = g_ceph_context->_conf->ms_public_type.empty() ? g_ceph_context->_conf->get_val<std::string>("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;
diff --git a/src/test/osd/TestOSDScrub.cc b/src/test/osd/TestOSDScrub.cc
index c39ce96cc09..b1f22b7716e 100644
--- a/src/test/osd/TestOSDScrub.cc
+++ b/src/test/osd/TestOSDScrub.cc
@@ -56,7 +56,7 @@ TEST(TestOSDScrub, scrub_time_permit) {
g_conf->osd_objectstore,
g_conf->osd_data,
g_conf->osd_journal);
- std::string cluster_msgr_type = g_conf->ms_cluster_type.empty() ? g_conf->ms_type : g_conf->ms_cluster_type;
+ std::string cluster_msgr_type = g_conf->ms_cluster_type.empty() ? g_conf->get_val<std::string>("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);
diff --git a/src/test/testmsgr.cc b/src/test/testmsgr.cc
index 26c3f398e5a..369587a9b2a 100644
--- a/src/test/testmsgr.cc
+++ b/src/test/testmsgr.cc
@@ -92,7 +92,7 @@ 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;
+ std::string public_msgr_type = g_conf->ms_public_type.empty() ? g_conf->get_val<std::string>("ms_type") : g_conf->ms_public_type;
Messenger *rank = Messenger::create(g_ceph_context,
public_msgr_type,
entity_name_t::MON(whoami), "tester",