Skip to content

Commit

Permalink
rgw: multipart copy, check for empty bucket, improve logging
Browse files Browse the repository at this point in the history
also reduce log level for non critical user errors.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
  • Loading branch information
yehudasa committed Sep 29, 2016
1 parent 4049e47 commit 2bcb3d2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/rgw/rgw_rest_s3.cc
Expand Up @@ -1067,7 +1067,7 @@ int RGWPutObj_ObjStore_S3::get_params()
pos = copy_source_bucket_name.find("/");
if (pos == std::string::npos) {
ret = -EINVAL;
ldout(s->cct, 0) << "x-amz-copy-source bad format" << dendl;
ldout(s->cct, 5) << "x-amz-copy-source bad format" << dendl;
return ret;
}
copy_source_object_name = copy_source_bucket_name.substr(pos + 1, copy_source_bucket_name.size());
Expand All @@ -1078,13 +1078,19 @@ int RGWPutObj_ObjStore_S3::get_params()
} else {
copy_source_tenant_name = copy_source_bucket_name.substr(0, pos);
copy_source_bucket_name = copy_source_bucket_name.substr(pos + 1, copy_source_bucket_name.size());
if (copy_source_bucket_name.empty()) {
ret = -EINVAL;
ldout(s->cct, 5) << "source bucket name is empty" << dendl;
return ret;
}
}
ret = store->get_bucket_info(obj_ctx,
copy_source_tenant_name,
copy_source_bucket_name,
copy_source_bucket_info,
NULL, &src_attrs);
if (ret < 0) {
ldout(s->cct, 5) << __func__ << "(): get_bucket_info() returned ret=" << ret << dendl;
return ret;
}

Expand All @@ -1095,14 +1101,14 @@ int RGWPutObj_ObjStore_S3::get_params()
pos = range.find("=");
if (pos == std::string::npos) {
ret = -EINVAL;
ldout(s->cct, 0) << "x-amz-copy-source-range bad format" << dendl;
ldout(s->cct, 5) << "x-amz-copy-source-range bad format" << dendl;
return ret;
}
range = range.substr(pos + 1, range.size());
pos = range.find("-");
if (pos == std::string::npos) {
ret = -EINVAL;
ldout(s->cct, 0) << "x-amz-copy-source-range bad format" << dendl;
ldout(s->cct, 5) << "x-amz-copy-source-range bad format" << dendl;
return ret;
}
string first = range.substr(0, pos);
Expand Down

0 comments on commit 2bcb3d2

Please sign in to comment.