Skip to content

Commit

Permalink
rgw: swift shouldn't change obj storage policy during change obj meta
Browse files Browse the repository at this point in the history
Signed-off-by: Jiaying Ren <jiaying.ren@umcloud.com>
  • Loading branch information
Jiaying Ren committed Jul 18, 2017
1 parent b39a402 commit 2326e8a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/rgw/rgw_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3997,6 +3997,13 @@ void RGWPutMetadataObject::execute()
}

rgw_get_request_metadata(s->cct, s->info, attrs);

if (!requested_placement_id.empty() &&
requested_placement_id != s->bucket_info.placement_rule) {
op_ret = -EEXIST;
return;
}

/* check if obj exists, read orig attrs */
op_ret = get_obj_attrs(store, s, obj, orig_attrs);
if (op_ret < 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/rgw/rgw_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ class RGWPutMetadataBucket : public RGWOp {
class RGWPutMetadataObject : public RGWOp {
protected:
RGWAccessControlPolicy policy;
string placement_rule;
std::string requested_placement_id;
boost::optional<ceph::real_time> delete_at;
const char *dlo_manifest;

Expand Down
2 changes: 1 addition & 1 deletion src/rgw/rgw_rest_swift.cc
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ int RGWPutMetadataObject_ObjStore_SWIFT::get_params()
return r;
}

placement_rule = s->info.env->get("HTTP_X_STORAGE_POLICY", "");
requested_placement_id = s->info.env->get("HTTP_X_STORAGE_POLICY", "");
dlo_manifest = s->info.env->get("HTTP_X_OBJECT_MANIFEST");

return 0;
Expand Down

0 comments on commit 2326e8a

Please sign in to comment.