]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Monitor: have reply functions for op requests
authorJoao Eduardo Luis <joao@redhat.com>
Fri, 27 Feb 2015 19:06:56 +0000 (19:06 +0000)
committerJoao Eduardo Luis <joao@suse.de>
Thu, 16 Jul 2015 17:03:39 +0000 (18:03 +0100)
Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
src/mon/Monitor.cc
src/mon/Monitor.h

index 900ac4f58b7f41b1c5dfc0996da78443e0b95e00..e716ea4edb556de46746945622c7518a0a1ca219 100644 (file)
@@ -3008,6 +3008,17 @@ void Monitor::reply_command(MMonCommand *m, int rc, const string &rs, bufferlist
   send_reply(m, reply);
 }
 
+void Monitor::reply_command(MonOpRequestRef op, int rc, const string &rs,
+                            bufferlist& rdata, version_t version)
+{
+  MMonCommand *m = static_cast<MMonCommand*>(op->get_req());
+  assert(m->get_type() == MSG_MON_COMMAND);
+  MMonCommandAck *reply = new MMonCommandAck(m->cmd, rc, rs, version);
+  reply->set_tid(m->get_tid());
+  reply->set_data(rdata);
+  send_reply(op, reply);
+}
+
 
 // ------------------------
 // request/reply routing
@@ -3159,6 +3170,13 @@ void Monitor::try_send_message(Message *m, const entity_inst_t& to)
   }
 }
 
+void Monitor::send_reply(MonOpRequestRef op, Message *reply)
+{
+  dout(2) << __func__ << " " << op << " " << *reply << dendl;
+  op->send_reply(reply);
+}
+
+
 void Monitor::send_reply(PaxosServiceMessage *req, Message *reply)
 {
   ConnectionRef connection = req->get_connection();
index a5cc6e3582312f68ad333f78438e1519171907d7..ab7876f1fb420334a9df2a9a07fa62f527e8c940 100644 (file)
@@ -761,6 +761,7 @@ public:
 
   void reply_command(MMonCommand *m, int rc, const string &rs, version_t version);
   void reply_command(MMonCommand *m, int rc, const string &rs, bufferlist& rdata, version_t version);
+  void reply_command(MonOpRequestRef op, int rc, const string &rs, bufferlist& rdata, version_t version);
 
 
   void handle_probe(MonOpRequestRef op);
@@ -803,6 +804,7 @@ public:
   void handle_forward(MonOpRequestRef op);
   void try_send_message(Message *m, const entity_inst_t& to);
   void send_reply(PaxosServiceMessage *req, Message *reply);
+  void send_reply(MonOpRequestRef op, Message *reply);
   void no_reply(PaxosServiceMessage *req);
   void resend_routed_requests();
   void remove_session(MonSession *s);