]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: make 'mon add ...' work
authorSage Weil <sage@newdream.net>
Thu, 15 Oct 2009 19:10:31 +0000 (12:10 -0700)
committerSage Weil <sage@newdream.net>
Thu, 15 Oct 2009 19:10:31 +0000 (12:10 -0700)
src/mon/MonmapMonitor.cc

index 69e17dc5d8a7125ea2bc90138307051787c8028e..aeb8e3779c3f66a25c312a4f9843d17172afb07d 100644 (file)
@@ -125,7 +125,9 @@ bool MonmapMonitor::preprocess_command(MMonCommand *m)
        } else 
          ss << "specify mon number or *";
       }
-    } 
+    }
+    else if (m->cmd[1] == "add")
+      return false;
   }
 
   if (r != -1) {
@@ -159,7 +161,7 @@ bool MonmapMonitor::prepare_command(MMonCommand *m)
   string rs;
   int err = -EINVAL;
   if (m->cmd.size() > 1) {
-    if (m->cmd.size() == 2 && m->cmd[1] == "add") {
+    if (m->cmd.size() == 3 && m->cmd[1] == "add") {
       entity_addr_t addr;
       parse_ip_port(m->cmd[2].c_str(), addr);
       bufferlist rdata;
@@ -171,7 +173,7 @@ bool MonmapMonitor::prepare_command(MMonCommand *m)
 
       pending_map.add(addr);
       pending_map.last_changed = g_clock.now();
-      ss << "added mon " << addr;
+      ss << "added mon" << (pending_map.size()-1) << " at " << addr;
       getline(ss, rs);
       paxos->wait_for_commit(new Monitor::C_Command(mon, m, 0, rs, paxos->get_version()));
       return true;