From 7b8502c9a2cb5bd02f69664a74cb73cc029a0d02 Mon Sep 17 00:00:00 2001 From: Enming Zhang Date: Fri, 13 Oct 2017 17:00:15 +0800 Subject: [PATCH] rgw: copy object add response error message Signed-off-by: Enming Zhang --- src/rgw/rgw_rest_s3.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 3fc2b51adbe..7d2ac9665c0 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -2102,7 +2102,8 @@ int RGWCopyObj_ObjStore_S3::get_params() } else if (!source_zone.empty()) { attrs_mod = RGWRados::ATTRSMOD_NONE; // default for intra-zone_group copy } else { - ldout(s->cct, 0) << "invalid metadata directive" << dendl; + s->err.message = "Unknown metadata directive."; + ldout(s->cct, 0) << s->err.message << dendl; return -EINVAL; } } @@ -2114,8 +2115,10 @@ int RGWCopyObj_ObjStore_S3::get_params() src_object.instance.empty() && (attrs_mod != RGWRados::ATTRSMOD_REPLACE)) { /* can only copy object into itself if replacing attrs */ - ldout(s->cct, 0) << "can't copy object into itself if not replacing attrs" - << dendl; + s->err.message = "This copy request is illegal because it is trying to copy " + "an object to itself without changing the object's metadata, " + "storage class, website redirect location or encryption attributes."; + ldout(s->cct, 0) << s->err.message << dendl; return -ERR_INVALID_REQUEST; } return 0; -- 2.39.5