]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: update bucket cors in secondary zonegroup should forward to master 15453/head
authorlu.shasha <lu.shasha@eisoo.com>
Wed, 24 May 2017 08:06:07 +0000 (16:06 +0800)
committerNathan Cutler <ncutler@suse.com>
Tue, 20 Jun 2017 21:54:09 +0000 (23:54 +0200)
pr#14082 is incomplete, cors should be redirect to master

Fixes: http://tracker.ceph.com/issues/16888
Signed-off-by: Shasha Lu <lu.shasha@eisoo.com>
(cherry picked from commit 7dd099588a47024b410d513cb8ea919731718fa7)

Conflicts:
src/rgw/rgw_op.cc (jewel does not have 5fff6371d8e)
src/test/rgw/rgw_multi/tests.py (jewel does not have this file)

src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_rest_s3.cc

index 3dd1690a72888bb6cc275fcb51658120e91cea2f..24d1187a823bbf4dfa170212cb0fbeb72c4aef2f 100644 (file)
@@ -3734,6 +3734,14 @@ void RGWPutCORS::execute()
   if (op_ret < 0)
     return;
 
+  if (!store->is_meta_master()) {
+    op_ret = forward_request_to_master(s, NULL, store, in_data, nullptr);
+    if (op_ret < 0) {
+      ldout(s->cct, 20) << __func__ << "forward_request_to_master returned ret=" << op_ret << dendl;
+      return;
+    }
+  }
+
   bool is_object_op = (!s->object.empty());
   if (is_object_op) {
     store->get_bucket_instance_obj(s->bucket, obj);
index 2ec2353534ea146d1c0eeea11e89e5af69ba4f78..527d8befe1bea6587cce4022588e8af7ddaf45e9 100644 (file)
@@ -1032,6 +1032,7 @@ public:
 class RGWPutCORS : public RGWOp {
 protected:
   bufferlist cors_bl;
+  bufferlist in_data;
 
 public:
   RGWPutCORS() {}
index e99c3866a5168fbcc424eb3cab49ae3e42f29085..08f105460734ef686c28ec2d320be3083281c7db 100644 (file)
@@ -2441,6 +2441,12 @@ int RGWPutCORS_ObjStore_S3::get_params()
     goto done_err;
   }
 
+  // forward bucket cors requests to meta master zone
+  if (!store->is_meta_master()) {
+    /* only need to keep this data around if we're not meta master */
+    in_data.append(data, len);
+  }
+
   if (s->cct->_conf->subsys.should_gather(ceph_subsys_rgw, 15)) {
     ldout(s->cct, 15) << "CORSConfiguration";
     cors_config->to_xml(*_dout);