From 71d2eca3e00de19419fb07bf9346f5863b20d40f Mon Sep 17 00:00:00 2001 From: "lu.shasha" Date: Fri, 25 Aug 2017 15:05:52 +0800 Subject: [PATCH] rgw: return bucket's location no matter which zonegroup it located in. Get bucket location which is created in another zonegroup, will return "301 Moved Permanently". Fixes: http://tracker.ceph.com/issues/21125 Signed-off-by: Shasha Lu --- src/rgw/rgw_common.h | 1 + src/rgw/rgw_op.cc | 2 ++ src/rgw/rgw_op.h | 1 + 3 files changed, 4 insertions(+) diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index f0e061cb010..30f5e770cdc 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -436,6 +436,7 @@ enum RGWOpType { RGW_OP_STAT_ACCOUNT, RGW_OP_LIST_BUCKET, RGW_OP_GET_BUCKET_LOGGING, + RGW_OP_GET_BUCKET_LOCATION, RGW_OP_GET_BUCKET_VERSIONING, RGW_OP_SET_BUCKET_VERSIONING, RGW_OP_GET_BUCKET_WEBSITE, diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index db00d2ea627..93fe17d8269 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -495,6 +495,8 @@ int rgw_build_bucket_policies(RGWRados* store, struct req_state* s) */ if (store->get_zonegroup().is_master_zonegroup() && s->system_request) { /*If this is the master, don't redirect*/ + } else if (s->op_type == RGW_OP_GET_BUCKET_LOCATION ) { + /* If op is get bucket location, don't redirect */ } else if (!s->local_source || (s->op != OP_PUT && s->op != OP_COPY) || s->object.empty()) { diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index d9ce2b40001..b8fe07d3a73 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -739,6 +739,7 @@ public: void send_response() override = 0; const string name() override { return "get_bucket_location"; } + RGWOpType get_type() override { return RGW_OP_GET_BUCKET_LOCATION; } uint32_t op_mask() override { return RGW_OP_TYPE_READ; } }; -- 2.39.5