]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MonClient: fix error in 'ceph ping mon.id' 5343/head
authorhuangjun <hjwsm1989@gmail.com>
Thu, 3 Sep 2015 11:10:03 +0000 (19:10 +0800)
committerhuangjun <hjwsm1989@gmail.com>
Thu, 3 Sep 2015 11:10:03 +0000 (19:10 +0800)
Fixes: #12442
Signed-off-by: huangjun <hjwsm1989@gmail.com>
src/mon/MonClient.cc

index 6624e6be30335e27882698d0178bdd0c385bd4f4..35c5e726c3ca3a645d83f3f3a4929e151c22c571 100644 (file)
@@ -207,11 +207,18 @@ int MonClient::ping_monitor(const string &mon_id, string *result_reply)
 {
   ldout(cct, 10) << __func__ << dendl;
 
-  if (mon_id.empty()) {
+  string new_mon_id;
+  if (monmap.contains("noname-"+mon_id)) {
+    new_mon_id = "noname-"+mon_id;
+  } else {
+    new_mon_id = mon_id;
+  }
+
+  if (new_mon_id.empty()) {
     ldout(cct, 10) << __func__ << " specified mon id is empty!" << dendl;
     return -EINVAL;
-  } else if (!monmap.contains(mon_id)) {
-    ldout(cct, 10) << __func__ << " no such monitor 'mon." << mon_id << "'"
+  } else if (!monmap.contains(new_mon_id)) {
+    ldout(cct, 10) << __func__ << " no such monitor 'mon." << new_mon_id << "'"
                    << dendl;
     return -ENOENT;
   }
@@ -224,8 +231,8 @@ int MonClient::ping_monitor(const string &mon_id, string *result_reply)
   smsgr->add_dispatcher_head(pinger);
   smsgr->start();
 
-  ConnectionRef con = smsgr->get_connection(monmap.get_inst(mon_id));
-  ldout(cct, 10) << __func__ << " ping mon." << mon_id
+  ConnectionRef con = smsgr->get_connection(monmap.get_inst(new_mon_id));
+  ldout(cct, 10) << __func__ << " ping mon." << new_mon_id
                  << " " << con->get_peer_addr() << dendl;
   con->send_message(new MPing);