]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/msg: Remove MMonAdd; switch MonmapMonitor to use MMonCommand
authorGreg Farnum <gregf@hq.newdream.net>
Mon, 12 Oct 2009 17:34:50 +0000 (10:34 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Mon, 12 Oct 2009 17:34:50 +0000 (10:34 -0700)
src/Makefile.am
src/messages/MMonAdd.h [deleted file]
src/mon/Monitor.cc
src/mon/MonmapMonitor.cc
src/msg/Message.cc
src/msg/Message.h

index d2bd25016a9c6faff4aa4c3e742bc6150658792c..938d665985e6d169137cad8e6cb21856cc537b1c 100644 (file)
@@ -570,7 +570,6 @@ noinst_HEADERS = \
         messages/MMonObserve.h\
         messages/MMonObserveNotify.h\
         messages/MMonPaxos.h\
-       messages/MMonAdd.h\
         messages/MMonSubscribe.h\
         messages/MMonSubscribeAck.h\
         messages/MOSDAlive.h\
diff --git a/src/messages/MMonAdd.h b/src/messages/MMonAdd.h
deleted file mode 100644 (file)
index fe5096c..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2009 Sage Weil <sage@newdream.net>
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software 
- * Foundation.  See file COPYING.
- * 
- */
-
-#ifndef __MMONADD_H
-#define __MMONADD_H
-
-#include "msg/Message.h"
-#include "include/types.h"
-
-#include "mon/MonMap.h"
-#include "config.h"
-
-class MMonAdd : public Message {
- public:
-  entity_addr_t address;
-
-  MMonAdd() : Message(MSG_MON_ADD) {}
-  MMonAdd(const char *ip) : Message(MSG_MON_ADD) {
-    parse_ip_port(ip, address);}
-  MMonAdd(const struct entity_addr_t& addr) :
-    Message(MSG_MON_ADD), address(addr) {}
-
-  const char* get_type_name() { return "mon_add"; }
-  void print (ostream& o) { o << "mon_add(" << address << ")"; }
-
-  void decode_payload() {
-    bufferlist::iterator p = payload.begin();
-    ::decode(address, p);
-  }
-
-  void encode_payload() {
-    ::encode(address, payload);
-  }
-};
-
-#endif
index ee680b0b3f614dc88d8f090d94c99bd2031bd717..fad4df4077c6389ce1fcd231f5cc150ce31a39bc 100644 (file)
@@ -255,6 +255,10 @@ void Monitor::handle_command(MMonCommand *m)
       clientmon()->dispatch(m);
       return;
     }
+    if (m->cmd[0] == "mon") {
+      monmon()->dispatch(m);
+      return;
+    }
     if (m->cmd[0] == "stop") {
       shutdown();
       reply_command(m, 0, "stopping", 0);
index a490220ce8c5b44654694358cb4ebc00b6a96e1a..9c9f5121a7878b23be7625792c7b047ae544fec6 100644 (file)
@@ -16,7 +16,7 @@
 #include "Monitor.h"
 #include "MonitorStore.h"
 
-#include "messages/MMonAdd.h"
+#include "messages/MMonCommand.h"
 #include "common/Timer.h"
 
 #include <sstream>
@@ -84,8 +84,15 @@ bool MonmapMonitor::preprocess_query(PaxosServiceMessage *m)
 
 bool MonmapMonitor::prepare_update(PaxosServiceMessage *message)
 {
-  MMonAdd *m = (MMonAdd *) message;
-  pending_map.add(m->address);
+  MMonCommand *m = (MMonCommand *) message;
+  if (m->cmd[1] != "add") {
+    dout(0) << "Unrecognized MonmapMonitor command!" << dendl;
+    delete message;
+    return false;
+  }
+  entity_addr_t addr;
+  parse_ip_port(m->cmd[2].c_str(), addr);
+  pending_map.add(addr);
   pending_map.last_changed = g_clock.now();
   delete message;
   return true;
index bc17a888c87417dc8b1a56d2b5e00ce4913faad4..e224daabfe063f3c71e7a812fd9431c03f02ab07 100644 (file)
@@ -26,7 +26,6 @@ using namespace std;
 #include "messages/MMonCommand.h"
 #include "messages/MMonCommandAck.h"
 #include "messages/MMonPaxos.h"
-#include "messages/MMonAdd.h"
 #include "messages/MMonObserve.h"
 #include "messages/MMonObserveNotify.h"
 
@@ -217,9 +216,6 @@ Message *decode_message(ceph_msg_header& header, ceph_msg_footer& footer,
   case MSG_MON_PAXOS:
     m = new MMonPaxos;
     break;
-  case MSG_MON_ADD:
-    m = new MMonAdd;
-    break;
 
   case MSG_MON_ELECTION:
     m = new MMonElection;
index e34c6f7b7775af44d9f0da54537c94c9c97a1ea2..8e5e6676f601c1ae8f9b628a025cf9efd17ecec4 100644 (file)
@@ -22,7 +22,6 @@
 // monitor internal
 #define MSG_MON_ELECTION           60
 #define MSG_MON_PAXOS              61
-#define MSG_MON_ADD                62
 /* monitor <-> mon admin tool */
 #define MSG_MON_COMMAND            50
 #define MSG_MON_COMMAND_ACK        51