diff options
author | zhang Shaowen <zhangshaowen@cmss.chinamobile.com> | 2019-05-20 05:22:48 +0200 |
---|---|---|
committer | zhang Shaowen <zhangshaowen@cmss.chinamobile.com> | 2019-06-12 05:19:04 +0200 |
commit | 57891092902b0fc48abe7d3166b5e69a2a93d035 (patch) | |
tree | 532110656b9a0e2d0c52c07045ecedd06a599002 | |
parent | rgw: add object lock doc. (diff) | |
download | ceph-57891092902b0fc48abe7d3166b5e69a2a93d035.tar.xz ceph-57891092902b0fc48abe7d3166b5e69a2a93d035.zip |
rgw: fix some errors in params
Signed-off-by: zhang Shaowen <zhangshaowen@cmss.chinamobile.com>
-rw-r--r-- | src/rgw/rgw_common.cc | 2 | ||||
-rw-r--r-- | src/rgw/rgw_common.h | 3 | ||||
-rw-r--r-- | src/rgw/rgw_rest_s3.cc | 15 |
3 files changed, 8 insertions, 12 deletions
diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 6245aa9ec44..1a34b9750be 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -97,7 +97,7 @@ rgw_http_errors rgw_http_s3_errors({ { ERR_NO_SUCH_SUBUSER, {404, "NoSuchSubUser"}}, { ERR_NO_SUCH_ENTITY, {404, "NoSuchEntity"}}, { ERR_NO_SUCH_CORS_CONFIGURATION, {404, "NoSuchCORSConfiguration"}}, - { ERR_NO_SUCH_OBJECT_LOCK_CONFIGURATION, {404, "NoSuchObjectLockConfiguration"}}, + { ERR_NO_SUCH_OBJECT_LOCK_CONFIGURATION, {404, "ObjectLockConfigurationNotFoundError"}}, { ERR_METHOD_NOT_ALLOWED, {405, "MethodNotAllowed" }}, { ETIMEDOUT, {408, "RequestTimeout" }}, { EEXIST, {409, "BucketAlreadyExists" }}, diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 9c07f5e9e4b..be2e9ee9193 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -85,8 +85,6 @@ using ceph::crypto::MD5; #define RGW_ATTR_OBJECT_LOCK RGW_ATTR_PREFIX "object-lock" #define RGW_ATTR_OBJECT_RETENTION RGW_ATTR_PREFIX "object-retention" #define RGW_ATTR_OBJECT_LEGAL_HOLD RGW_ATTR_PREFIX "object-legal-hold" -#define RGW_ATTR_OBJECT_LOCK_MODE RGW_ATTR_PREFIX "object-lock-mode" -#define RGW_ATTR_OBJECT_LOCK_UNTIL_DATE RGW_ATTR_PREFIX "object-lock-until-date" #define RGW_ATTR_PG_VER RGW_ATTR_PREFIX "pg_ver" @@ -219,7 +217,6 @@ using ceph::crypto::MD5; #define ERR_MFA_REQUIRED 2044 #define ERR_NO_SUCH_CORS_CONFIGURATION 2045 #define ERR_NO_SUCH_OBJECT_LOCK_CONFIGURATION 2046 -#define ERR_INVALID_BUCKET_STATE 2047 #define ERR_USER_SUSPENDED 2100 #define ERR_INTERNAL_ERROR 2200 #define ERR_NOT_IMPLEMENTED 2201 diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 39b380c16fd..c08ef1158e6 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -329,12 +329,11 @@ int RGWGetObj_ObjStore_S3::send_response_data(bufferlist& bl, off_t bl_ofs, ldpp_dout(this,0) << "Error caught buffer::error couldn't decode TagSet " << dendl; } dump_header(s, RGW_AMZ_TAG_COUNT, obj_tags.count()); - } else if (iter->first.compare(RGW_ATTR_OBJECT_LOCK_MODE) == 0 && get_retention) { - dump_header(s, "x-amz-object-lock-mode", iter->second.to_str()); - } else if (iter->first.compare(RGW_ATTR_OBJECT_LOCK_UNTIL_DATE) == 0 && get_retention) { - real_time lock_until_date; - decode(lock_until_date, iter->second); - dump_time_header(s, "x-amz-object-lock-retain-until-date", lock_until_date); + } else if (iter->first.compare(RGW_ATTR_OBJECT_RETENTION) == 0 && get_retention){ + RGWObjectRetention retention; + decode(retention, iter->second); + dump_header(s, "x-amz-object-lock-mode", retention.get_mode()); + dump_time_header(s, "x-amz-object-lock-retain-until-date", retention.get_retain_until_date()); } } } @@ -1375,10 +1374,10 @@ int RGWCreateBucket_ObjStore_S3::get_params() } auto iter = s->info.x_meta_map.find("x-amz-bucket-object-lock-enabled"); if (iter != s->info.x_meta_map.end()) { - if ((iter->second.compare("true") != 0 && (iter->second.compare("false") != 0))) { + if (!boost::algorithm::iequals(iter->second, "true") && !boost::algorithm::iequals(iter->second, "false")) { return -EINVAL; } - obj_lock_enabled = iter->second.compare("true") == 0; + obj_lock_enabled = boost::algorithm::iequals(iter->second, "true"); } return 0; } |