]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/fio/fio_ceph_messenger: make exec multi client on the same host. 28464/head
authorJianpeng Ma <jianpeng.ma@intel.com>
Tue, 11 Jun 2019 07:21:39 +0000 (15:21 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Tue, 11 Jun 2019 08:15:19 +0000 (16:15 +0800)
When create Messenger, for client we should give different nonce to
make multi clients on the same host can work. Otherwise, server only
accept one connection.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/test/fio/fio_ceph_messenger.cc

index 7b1984694fb07bca52158db5a790303b95587e62..49c8e12e0c12e600b9196b2b30cd4d6b6485ea77 100644 (file)
@@ -300,8 +300,10 @@ static Messenger *create_messenger(struct ceph_msgr_options *o)
     ceph_msgr_types[o->ms_type] :
     g_ceph_context->_conf.get_val<std::string>("ms_type");
 
+  /* o->td__>pid doesn't set value, so use getpid() instead*/
+  auto nonce = o->is_receiver ? 0 : (getpid() + o->td__->thread_number);
   Messenger *msgr = Messenger::create(g_ceph_context, ms_type.c_str(),
-                                     ename, lname, 0, flags);
+                                     ename, lname, nonce, flags);
   if (o->is_receiver) {
     msgr->set_default_policy(Messenger::Policy::stateless_server(0));
     msgr->bind(hostname_to_addr(o));
@@ -385,6 +387,7 @@ static void put_messenger(struct ceph_msgr_data *data)
 static int fio_ceph_msgr_setup(struct thread_data *td)
 {
   struct ceph_msgr_options *o = (decltype(o))td->eo;
+  o->td__ = td;
   ceph_msgr_data *data;
 
   /* We have to manage global resources so we use threads */