From: Casey Bodley Date: Mon, 22 Aug 2022 20:39:46 +0000 (-0400) Subject: rgw: fetch_remote_obj() adds x-amz-replication-status=REPLICA X-Git-Tag: v18.1.0~487^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=ca762e628e43f3546369ffbd33acc9d33f73da0c;p=ceph-ci.git rgw: fetch_remote_obj() adds x-amz-replication-status=REPLICA implements the easy part of amazon's x-amz-replication-status feature: https://docs.aws.amazon.com/AmazonS3/latest/userguide/replication-status.html#replication-status-overview Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 3a5f2cd8824..6102f6b0dee 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -136,6 +136,8 @@ using ceph::crypto::MD5; #define RGW_ATTR_APPEND_PART_NUM RGW_ATTR_PREFIX "append_part_num" +#define RGW_ATTR_OBJ_REPLICATION_STATUS RGW_ATTR_PREFIX "amz-replication-status" + /* IAM Policy */ #define RGW_ATTR_IAM_POLICY RGW_ATTR_PREFIX "iam-policy" #define RGW_ATTR_USER_POLICY RGW_ATTR_PREFIX "user-policy" diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index c5e5d53a3df..b8fd34161c1 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -4058,6 +4058,12 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx, //erase the append attr cb.get_attrs().erase(RGW_ATTR_APPEND_PART_NUM); + { // add x-amz-replication-status=REPLICA + auto& bl = cb.get_attrs()[RGW_ATTR_OBJ_REPLICATION_STATUS]; + bl.clear(); // overwrite source's status + bl.append("REPLICA"); + } + if (source_zone.empty()) { set_copy_attrs(cb.get_attrs(), attrs, attrs_mod); } else { diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 932ab0226b9..87aabcfb85d 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -428,6 +428,11 @@ int RGWGetObj_ObjStore_S3::send_response_data(bufferlist& bl, off_t bl_ofs, } else { dump_header(s, "x-rgw-object-type", "Normal"); } + // replication status + if (auto i = attrs.find(RGW_ATTR_OBJ_REPLICATION_STATUS); + i != attrs.end()) { + dump_header(s, "x-amz-replication-status", i->second); + } if (! op_ret) { if (! lo_etag.empty()) {