From: Yehuda Sadeh Date: Mon, 12 Oct 2015 18:55:40 +0000 (-0700) Subject: rgw: location constraints should return api name X-Git-Tag: v9.2.0~9^2~11^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=03078bab6ee8c617025902dbe52ec19e64653c33;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 --- diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 570b00c0e9b1..487f1b114e09 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -393,13 +393,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); }