]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
MOSDOpReply: add a redirect member
authorGreg Farnum <greg@inktank.com>
Tue, 3 Sep 2013 21:59:59 +0000 (14:59 -0700)
committerGreg Farnum <greg@inktank.com>
Tue, 10 Sep 2013 22:33:49 +0000 (15:33 -0700)
When present, clients must send the request to the location specified
by the redirect (by using the combine_with_locator() function on
request_redirect_t).
A separate mechanism must be used to ensure that clients see and respect
the redirect, as we do not bump up the minimum required version to
decode.

Signed-off-by: Greg Farnum <greg@inktank.com>
src/messages/MOSDOpReply.h

index 279f5dd535a548e1ac429acccf588bc77ba0e4df..c0e989f7c3a0514d76a006ee683008b73165fa11 100644 (file)
@@ -31,7 +31,7 @@
 
 class MOSDOpReply : public Message {
 
-  static const int HEAD_VERSION = 5;
+  static const int HEAD_VERSION = 6;
   static const int COMPAT_VERSION = 2;
 
   object_t oid;
@@ -44,6 +44,7 @@ class MOSDOpReply : public Message {
   version_t user_version;
   epoch_t osdmap_epoch;
   int32_t retry_attempt;
+  request_redirect_t redirect;
 
 public:
   object_t get_oid() const { return oid; }
@@ -87,6 +88,10 @@ public:
     bad_replay_version = v;
   }
 
+  void set_redirect(const request_redirect_t& redir) { redirect = redir; }
+  const request_redirect_t& get_redirect() const { return redirect; }
+  bool is_redirect_reply() const { return !redirect.empty(); }
+
   void add_flags(int f) { flags |= f; }
 
   void claim_op_out_data(vector<OSDOp>& o) {
@@ -180,6 +185,7 @@ public:
 
       ::encode(replay_version, payload);
       ::encode(user_version, payload);
+      ::encode(redirect, payload);
     }
   }
   virtual void decode_payload() {
@@ -232,6 +238,9 @@ public:
        replay_version = bad_replay_version;
        user_version = replay_version.version;
       }
+
+      if (header.version >= 6)
+       ::decode(redirect, p);
     }
   }
 
@@ -253,6 +262,9 @@ public:
       char buf[80];
       out << " (" << strerror_r(-get_result(), buf, sizeof(buf)) << ")";
     }
+    if (is_redirect_reply()) {
+      out << " redirect: { " << redirect << " }";
+    }
     out << ")";
   }