From: Yehuda Sadeh Date: Sat, 13 Dec 2014 01:00:52 +0000 (-0800) Subject: rgw: cannot modify swift bucket policy X-Git-Tag: v0.91~55^2~8^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F2970%2Fhead;p=ceph.git rgw: cannot modify swift bucket policy When trying to set a policy on the bucket, fail unless policy matches current placement rule. Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 35b5c30193f2..a4a23123bc54 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -1908,6 +1908,13 @@ void RGWPutMetadata::execute() if (ret < 0) return; + if (!s->object && !placement_rule.empty()) { + if (placement_rule != s->bucket_info.placement_rule) { + ret = -EEXIST; + return; + } + } + /* only remove meta attrs */ for (iter = orig_attrs.begin(); iter != orig_attrs.end(); ++iter) { const string& name = iter->first; diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index d3b227e3ebaa..d818203b59fb 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -419,6 +419,7 @@ protected: bool has_policy, has_cors; RGWAccessControlPolicy policy; RGWCORSConfiguration cors_config; + string placement_rule; public: RGWPutMetadata() { diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc index 6122e2611e85..0b1d31c8ffc0 100644 --- a/src/rgw/rgw_rest_swift.cc +++ b/src/rgw/rgw_rest_swift.cc @@ -441,6 +441,7 @@ int RGWPutMetadata_ObjStore_SWIFT::get_params() return r; } } + placement_rule = s->info.env->get("HTTP_X_STORAGE_POLICY", ""); return 0; }