]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: fix error code of inexistence of versions location in swift api
authorJing Wenjun <jingwenjun@cmss.chinamobile.com>
Fri, 10 Feb 2017 09:21:41 +0000 (17:21 +0800)
committerJing Wenjun <jingwenjun@cmss.chinamobile.com>
Wed, 15 Feb 2017 06:55:05 +0000 (14:55 +0800)
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>
src/rgw/rgw_rados.cc

index 5f575990f6b2da9eacd16ef8c10e5627cf34bcae..fff61bba6429443183dcc1f0d7d313faa4aa9126 100644 (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);