From: Jing Wenjun Date: Fri, 10 Feb 2017 09:21:41 +0000 (+0800) Subject: rgw: fix error code of inexistence of versions location in swift api X-Git-Tag: v12.0.1~368^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e94e267c4d9fd3cc2bf34a0ab6a3f20795a15d3b;p=ceph.git rgw: fix error code of inexistence of versions location in swift api when the versions location of container does not exist and uploading the same object two more times to the container, it will return 412 rather than 404 in openstack swift. Meanwhile, if the dest bucket owner is not consistent with src bucket owner, it will return 412. http://tracker.ceph.com/issues/18880 Signed-off-by: Jing Wenjun --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 5f575990f6b2..fff61bba6429 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -6129,11 +6129,14 @@ int RGWRados::swift_versioning_copy(RGWObjectCtx& obj_ctx, r = get_bucket_info(obj_ctx, bucket_info.bucket.tenant, bucket_info.swift_ver_location, dest_bucket_info, NULL, NULL); if (r < 0) { ldout(cct, 10) << "failed to read dest bucket info: r=" << r << dendl; + if (r == -ENOENT) { + return -ERR_PRECONDITION_FAILED; + } return r; } if (dest_bucket_info.owner != bucket_info.owner) { - return -EPERM; + return -ERR_PRECONDITION_FAILED; } rgw_obj dest_obj(dest_bucket_info.bucket, buf);