]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: user policy: forward write requests to master zone 32476/head
authorAbhishek Lekshmanan <abhishek@suse.com>
Fri, 3 Jan 2020 14:11:38 +0000 (15:11 +0100)
committerAbhishek Lekshmanan <abhishek@suse.com>
Tue, 7 Jan 2020 10:27:56 +0000 (11:27 +0100)
Since earlier releases didn't forward the requests, have an additional pass
through for delete policy requests to allow deletion when no policy is seen in
the master zone

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
src/rgw/rgw_rest_user_policy.cc

index d534cb5f26ad5e4608cc2cab72394e17c43b8d59..356ea9883bea60e937c49226a9311011bd5bba0a 100644 (file)
@@ -15,6 +15,7 @@
 #include "rgw_op.h"
 #include "rgw_rest.h"
 #include "rgw_rest_user_policy.h"
+#include "services/svc_zone.h"
 
 #define dout_subsys ceph_subsys_rgw
 
@@ -131,6 +132,15 @@ void RGWPutUserPolicy::execute()
     return;
   }
 
+  if (!store->svc()->zone->is_meta_master()) {
+    ceph::bufferlist in_data;
+    op_ret = forward_request_to_master(s, nullptr, store, in_data, nullptr);
+    if (op_ret < 0) {
+      ldpp_dout(this, 0) << "ERROR: forward_request_to_master returned ret=" << op_ret << dendl;
+      return;
+    }
+  }
+
   try {
     const Policy p(s->cct, s->user->user_id.tenant, bl);
     map<string, string> policies;
@@ -328,6 +338,20 @@ void RGWDeleteUserPolicy::execute()
     return;
   }
 
+  if (!store->svc()->zone->is_meta_master()) {
+    ceph::bufferlist in_data;
+    op_ret = forward_request_to_master(s, nullptr, store, in_data, nullptr);
+    if (op_ret < 0) {
+      // a policy might've been uploaded to this site when there was no sync
+      // req. in earlier releases, proceed deletion
+      if (op_ret != -ENOENT) {
+        ldpp_dout(this, 5) << "forward_request_to_master returned ret=" << op_ret << dendl;
+        return;
+      }
+      ldpp_dout(this, 0) << "ERROR: forward_request_to_master returned ret=" << op_ret << dendl;
+    }
+  }
+
   map<string, string> policies;
   if (auto it = uattrs.find(RGW_ATTR_USER_POLICY); it != uattrs.end()) {
     bufferlist out_bl = uattrs[RGW_ATTR_USER_POLICY];