]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: location constraints should return api name 6237/head
authorYehuda Sadeh <yehuda@redhat.com>
Mon, 12 Oct 2015 18:55:40 +0000 (11:55 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Mon, 12 Oct 2015 18:55:40 +0000 (11:55 -0700)
Fixes: #13458
The S3 location constraints request should return the api name,
not the region name.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_rest_s3.cc

index 570b00c0e9b106e23936fe706074ffa17e1d1a2c..487f1b114e0917a98befc239520441bc844b18cb 100644 (file)
@@ -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<string, RGWRegion>::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);
 }