From: Yehuda Sadeh Date: Mon, 12 Oct 2015 18:55:40 +0000 (-0700) Subject: rgw: location constraints should return api name X-Git-Tag: v0.94.6~54^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6d89f4ba85063debe96734e9fdfcba247e770206;p=ceph.git rgw: location constraints should return api name Fixes: #13458 The S3 location constraints request should return the api name, not the region name. Signed-off-by: Yehuda Sadeh (cherry picked from commit 03078bab6ee8c617025902dbe52ec19e64653c33) --- diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index bca45331240b..de8aaac336db 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -372,13 +372,21 @@ void RGWGetBucketLocation_ObjStore_S3::send_response() end_header(s, this); dump_start(s); - string location_constraint(s->bucket_info.region); - if (s->bucket_info.region == "default") - location_constraint.clear(); + string region = s->bucket_info.region; + string api_name; + + map::iterator iter = store->region_map.regions.find(region); + if (iter != store->region_map.regions.end()) { + api_name = iter->second.api_name; + } else { + if (region != "default") { + api_name = region; + } + } s->formatter->dump_format_ns("LocationConstraint", "http://doc.s3.amazonaws.com/doc/2006-03-01/", - "%s",location_constraint.c_str()); + "%s",api_name.c_str()); rgw_flush_formatter_and_reset(s, s->formatter); }