summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Farnum <greg@inktank.com>2013-09-03 14:59:59 -0700
committerGreg Farnum <greg@inktank.com>2013-09-10 15:33:49 -0700
commitac1c92173ccb2e89239cf0e9fa6bea4c21064b36 (patch)
tree172016626fa3ec3fbba6cba3b5df212c8dc109bb
parenta45612c202cf0364d16f082861b7d3971713373f (diff)
downloadceph-ac1c92173ccb2e89239cf0e9fa6bea4c21064b36.tar.gz
MOSDOpReply: add a redirect member
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>
-rw-r--r--src/messages/MOSDOpReply.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/messages/MOSDOpReply.h b/src/messages/MOSDOpReply.h
index 279f5dd535a..c0e989f7c3a 100644
--- a/src/messages/MOSDOpReply.h
+++ b/src/messages/MOSDOpReply.h
@@ -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 << ")";
}