]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
add MMonGetOSDMap message
authorSage Weil <sage@redhat.com>
Sat, 16 Aug 2014 01:00:47 +0000 (18:00 -0700)
committerSage Weil <sage@redhat.com>
Mon, 10 Nov 2014 22:20:24 +0000 (14:20 -0800)
This message lets you explicitly request a range of full or incremental
maps from someone (the monitor, presumably), independent of any other
session state.

Signed-off-by: Sage Weil <sage@redhat.com>
src/include/ceph_fs.h
src/messages/MMonGetOSDMap.h [new file with mode: 0644]
src/messages/Makefile.am
src/msg/Message.cc

index d16df6272c2f36d5bc3c47daa69083f29bf07352..85757ddeec6a461eceb996ef112b789867628b4e 100644 (file)
@@ -93,6 +93,7 @@ struct ceph_dir_layout {
 /* client <-> monitor */
 #define CEPH_MSG_MON_MAP                4
 #define CEPH_MSG_MON_GET_MAP            5
+#define CEPH_MSG_MON_GET_OSDMAP         6
 #define CEPH_MSG_STATFS                 13
 #define CEPH_MSG_STATFS_REPLY           14
 #define CEPH_MSG_MON_SUBSCRIBE          15
diff --git a/src/messages/MMonGetOSDMap.h b/src/messages/MMonGetOSDMap.h
new file mode 100644 (file)
index 0000000..859d253
--- /dev/null
@@ -0,0 +1,87 @@
+// -*- 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) 2014 Red Hat
+ *
+ * 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 CEPH_MMONGETOSDMAP_H
+#define CEPH_MMONGETOSDMAP_H
+
+#include "msg/Message.h"
+
+#include "include/types.h"
+
+class MMonGetOSDMap : public PaxosServiceMessage {
+  epoch_t full_first, full_last;
+  epoch_t inc_first, inc_last;
+
+public:
+  MMonGetOSDMap()
+    : PaxosServiceMessage(CEPH_MSG_MON_GET_OSDMAP, 0),
+      full_first(0),
+      full_last(0),
+      inc_first(0),
+      inc_last(0) { }
+private:
+  ~MMonGetOSDMap() {}
+
+public:
+  void request_full(epoch_t first, epoch_t last) {
+    assert(last >= first);
+    full_first = first;
+    full_last = last;
+  }
+  void request_inc(epoch_t first, epoch_t last) {
+    assert(last >= first);
+    inc_first = first;
+    inc_last = last;
+  }
+  epoch_t get_full_first() const {
+    return full_first;
+  }
+  epoch_t get_full_last() const {
+    return full_last;
+  }
+  epoch_t get_inc_first() const {
+    return inc_first;
+  }
+  epoch_t get_inc_last() const {
+    return inc_last;
+  }
+
+  const char *get_type_name() const { return "mon_get_osdmap"; }
+  void print(ostream& out) const {
+    out << "mon_get_osdmap(";
+    if (full_first && full_last)
+      out << "full " << full_first << "-" << full_last;
+    if (inc_first && inc_last)
+      out << " inc" << inc_first << "-" << inc_last;
+    out << ")";
+  }
+
+  void encode_payload(uint64_t features) {
+    paxos_encode();
+    ::encode(full_first, payload);
+    ::encode(full_last, payload);
+    ::encode(inc_first, payload);
+    ::encode(inc_last, payload);
+  }
+  void decode_payload() {
+    bufferlist::iterator p = payload.begin();
+    paxos_decode(p);
+    ::decode(full_first, p);
+    ::decode(full_last, p);
+    ::decode(inc_first, p);
+    ::decode(inc_last, p);
+  }
+};
+
+#endif
index cac40482b00d9bd232476b7df2406dbadee14f96..38593f7e7240cf6d68bed5a6f210f03982777d79 100644 (file)
@@ -56,6 +56,7 @@ noinst_HEADERS += \
        messages/MMonCommandAck.h \
        messages/MMonElection.h \
        messages/MMonGetMap.h \
+       messages/MMonGetOSDMap.h \
        messages/MMonGetVersion.h \
        messages/MMonGetVersionReply.h \
        messages/MMonGlobalID.h \
index 7b1e331f0862ca0750df368d05066afbd647d902..ecda9a20b66b444aff5ecd5dad2200c3188946e9 100644 (file)
@@ -66,6 +66,7 @@ using namespace std;
 #include "messages/MOSDSubOp.h"
 #include "messages/MOSDSubOpReply.h"
 #include "messages/MOSDMap.h"
+#include "messages/MMonGetOSDMap.h"
 
 #include "messages/MOSDPGNotify.h"
 #include "messages/MOSDPGQuery.h"
@@ -376,6 +377,9 @@ Message *decode_message(CephContext *cct, ceph_msg_header& header, ceph_msg_foot
   case CEPH_MSG_MON_GET_MAP:
     m = new MMonGetMap;
     break;
+  case CEPH_MSG_MON_GET_OSDMAP:
+    m = new MMonGetOSDMap;
+    break;
   case CEPH_MSG_MON_GET_VERSION:
     m = new MMonGetVersion();
     break;