From: Greg Farnum Date: Mon, 12 Oct 2009 17:34:50 +0000 (-0700) Subject: mon/msg: Remove MMonAdd; switch MonmapMonitor to use MMonCommand X-Git-Tag: v0.17~78 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e2e8047a095f9e57c116c9e54fcbef2c5abf9796;p=ceph.git mon/msg: Remove MMonAdd; switch MonmapMonitor to use MMonCommand --- diff --git a/src/Makefile.am b/src/Makefile.am index d2bd25016a9c6..938d665985e6d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 index fe5096c0cae48..0000000000000 --- a/src/messages/MMonAdd.h +++ /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 - * - * 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 diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index ee680b0b3f614..fad4df4077c63 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -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); diff --git a/src/mon/MonmapMonitor.cc b/src/mon/MonmapMonitor.cc index a490220ce8c5b..9c9f5121a7878 100644 --- a/src/mon/MonmapMonitor.cc +++ b/src/mon/MonmapMonitor.cc @@ -16,7 +16,7 @@ #include "Monitor.h" #include "MonitorStore.h" -#include "messages/MMonAdd.h" +#include "messages/MMonCommand.h" #include "common/Timer.h" #include @@ -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; diff --git a/src/msg/Message.cc b/src/msg/Message.cc index bc17a888c8741..e224daabfe063 100644 --- a/src/msg/Message.cc +++ b/src/msg/Message.cc @@ -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; diff --git a/src/msg/Message.h b/src/msg/Message.h index e34c6f7b7775a..8e5e6676f601c 100644 --- a/src/msg/Message.h +++ b/src/msg/Message.h @@ -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