summaryrefslogtreecommitdiffstats
path: root/src/rgw/rgw_rest_user_policy.cc
diff options
context:
space:
mode:
authorAbhishek L <abhishek@suse.com>2020-01-30 12:50:02 +0100
committerGitHub <noreply@github.com>2020-01-30 12:50:02 +0100
commit58b310925bf32012984d1a0c8f5886f0f3d542a5 (patch)
tree5613e00a57e6d035cc93d6029780dcd55a646d96 /src/rgw/rgw_rest_user_policy.cc
parentMerge pull request #32370 from AlexZzz/prometheus_pg_status_bypool (diff)
parentrgw: user policy: forward write requests to master zone (diff)
downloadceph-58b310925bf32012984d1a0c8f5886f0f3d542a5.tar.xz
ceph-58b310925bf32012984d1a0c8f5886f0f3d542a5.zip
Merge pull request #32476 from theanalyst/rgw/multisite/user-policy
rgw: user policy: forward write requests to master zone Reviewed-By: Casey Bodley <cbodley@redhat.com>
Diffstat (limited to 'src/rgw/rgw_rest_user_policy.cc')
-rw-r--r--src/rgw/rgw_rest_user_policy.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/rgw/rgw_rest_user_policy.cc b/src/rgw/rgw_rest_user_policy.cc
index aed374fbfa7..6a73a67fd9e 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->get_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];