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 <jingwenjun@cmss.chinamobile.com>
This commit is contained in:
Jing Wenjun 2017-02-10 17:21:41 +08:00
parent 00417f0ecb
commit e94e267c4d

View File

@ -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);