diff options
author | Zhang Shaowen <zhangshaowen@cmss.chinamobile.com> | 2017-02-23 02:36:27 +0100 |
---|---|---|
committer | Zhang Shaowen <zhangshaowen@cmss.chinamobile.com> | 2017-04-05 13:01:35 +0200 |
commit | 433297d500314cf59287560c15784cce21026691 (patch) | |
tree | 3b5af6c98e30d59d45f2c3c2551a7330a3a2be75 /src/rgw/rgw_lc_s3.cc | |
parent | Merge pull request #14281 from tchaikov/wip-19429 (diff) | |
download | ceph-433297d500314cf59287560c15784cce21026691.tar.xz ceph-433297d500314cf59287560c15784cce21026691.zip |
rgw: add support for multipart upload expiration.
Fixes: http://tracker.ceph.com/issues/19088
Signed-off-by: Zhang Shaowen <zhangshaowen@cmss.chinamobile.com>
Diffstat (limited to 'src/rgw/rgw_lc_s3.cc')
-rw-r--r-- | src/rgw/rgw_lc_s3.cc | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/rgw/rgw_lc_s3.cc b/src/rgw/rgw_lc_s3.cc index 2b1e1d29508..99ed7b70cd6 100644 --- a/src/rgw/rgw_lc_s3.cc +++ b/src/rgw/rgw_lc_s3.cc @@ -16,7 +16,6 @@ using namespace std; bool LCExpiration_S3::xml_end(const char * el) { LCDays_S3 *lc_days = static_cast<LCDays_S3 *>(find_first("Days")); - // ID is mandatory if (!lc_days) return false; days = lc_days->get_data(); @@ -24,7 +23,7 @@ bool LCExpiration_S3::xml_end(const char * el) { } bool LCNoncurExpiration_S3::xml_end(const char *el) { - LCNoncurDays_S3 *lc_noncur_days = static_cast<LCNoncurDays_S3 *>(find_first("NoncurrentDays")); + LCDays_S3 *lc_noncur_days = static_cast<LCDays_S3 *>(find_first("NoncurrentDays")); if (!lc_noncur_days) { return false; } @@ -32,6 +31,15 @@ bool LCNoncurExpiration_S3::xml_end(const char *el) { return true; } +bool LCMPExpiration_S3::xml_end(const char *el) { + LCDays_S3 *lc_mp_days = static_cast<LCDays_S3 *>(find_first("DaysAfterInitiation")); + if (!lc_mp_days) { + return false; + } + days = lc_mp_days->get_data(); + return true; +} + bool RGWLifecycleConfiguration_S3::xml_end(const char *el) { XMLObjIter iter = find("Rule"); LCRule_S3 *rule = static_cast<LCRule_S3 *>(iter.get_next()); @@ -48,6 +56,7 @@ bool LCRule_S3::xml_end(const char *el) { LCStatus_S3 *lc_status; LCExpiration_S3 *lc_expiration; LCNoncurExpiration_S3 *lc_noncur_expiration; + LCMPExpiration_S3 *lc_mp_expiration; id.clear(); prefix.clear(); @@ -72,7 +81,8 @@ bool LCRule_S3::xml_end(const char *el) { lc_expiration = static_cast<LCExpiration_S3 *>(find_first("Expiration")); lc_noncur_expiration = static_cast<LCNoncurExpiration_S3 *>(find_first("NoncurrentVersionExpiration")); - if (!lc_expiration && !lc_noncur_expiration) { + lc_mp_expiration = static_cast<LCMPExpiration_S3 *>(find_first("AbortIncompleteMultipartUpload")); + if (!lc_expiration && !lc_noncur_expiration && !lc_mp_expiration) { return false; } else { if (lc_expiration) { @@ -81,6 +91,9 @@ bool LCRule_S3::xml_end(const char *el) { if (lc_noncur_expiration) { noncur_expiration = *lc_noncur_expiration; } + if (lc_mp_expiration) { + mp_expiration = *lc_mp_expiration; + } } return true; @@ -99,6 +112,10 @@ void LCRule_S3::to_xml(CephContext *cct, ostream& out) { LCNoncurExpiration_S3& noncur_expir = static_cast<LCNoncurExpiration_S3&>(noncur_expiration); noncur_expir.to_xml(out); } + if (!mp_expiration.empty()) { + LCMPExpiration_S3& mp_expir = static_cast<LCMPExpiration_S3&>(mp_expiration); + mp_expir.to_xml(out); + } out << "</Rule>"; } @@ -150,7 +167,11 @@ XMLObj *RGWLCXMLParser_S3::alloc_obj(const char *el) } else if (strcmp(el, "NoncurrentVersionExpiration") == 0) { obj = new LCNoncurExpiration_S3(); } else if (strcmp(el, "NoncurrentDays") == 0) { - obj = new LCNoncurDays_S3(); + obj = new LCDays_S3(); + } else if (strcmp(el, "AbortIncompleteMultipartUpload") == 0) { + obj = new LCMPExpiration_S3(); + } else if (strcmp(el, "DaysAfterInitiation") == 0) { + obj = new LCDays_S3(); } return obj; } |