From: Abhishek Lekshmanan Date: Fri, 3 Jan 2020 14:11:38 +0000 (+0100) Subject: rgw: user policy: forward write requests to master zone X-Git-Tag: v15.1.1~617^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8c0c87f0f634d64a60f7a126673ecb4a2f37b4b4;p=ceph.git rgw: user policy: forward write requests to master zone 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 --- diff --git a/src/rgw/rgw_rest_user_policy.cc b/src/rgw/rgw_rest_user_policy.cc index d534cb5f26a..356ea9883be 100644 --- a/src/rgw/rgw_rest_user_policy.cc +++ b/src/rgw/rgw_rest_user_policy.cc @@ -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 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 policies; if (auto it = uattrs.find(RGW_ATTR_USER_POLICY); it != uattrs.end()) { bufferlist out_bl = uattrs[RGW_ATTR_USER_POLICY];