From 74d776f11ef166d89fc4c8aa5ad1985c129abd3b Mon Sep 17 00:00:00 2001 From: Jiffin Tony Thottan Date: Tue, 24 Jun 2025 11:49:41 +0530 Subject: [PATCH] cloud restore : add None type for cloud-s3-glacier AWS supports various glacier conf options such as Standard, Expetided to restore object with in a time period. Theses options may not be supported in other S3 servers. So introducing option NoTier, so other vendors can be supported. Resolves: rhbz#2365095 Signed-off-by: Jiffin Tony Thottan (cherry picked from commit a6e199398e6886806037467ae16bdef55f77b6c8) --- doc/radosgw/cloud-restore.rst | 6 ++++-- src/rgw/driver/rados/rgw_lc_tier.cc | 6 ++++-- src/rgw/driver/rados/rgw_zone.cc | 8 +++++--- src/rgw/rgw_zone.cc | 17 +++++++++++++---- src/rgw/rgw_zone_types.h | 1 + 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/doc/radosgw/cloud-restore.rst b/doc/radosgw/cloud-restore.rst index 63a7d59ffa0..d546bc59d1d 100644 --- a/doc/radosgw/cloud-restore.rst +++ b/doc/radosgw/cloud-restore.rst @@ -92,10 +92,12 @@ the following configurables should be set accordingly: The duration for which the objects are to be restored on the remote cloud service. -* ``glacier_restore_tier_type`` (``Standard`` | ``Expedited``) +* ``glacier_restore_tier_type`` (``Standard`` | ``Expedited`` | ``NoTier``) The type of retrieval within the cloud service, which may represent different -pricing. Supported options are ``Standard`` and ``Expedited``. +pricing. Supported options are ``Standard``, ``Expedited`` and ``NoTier``. + +``NoTier`` for the s3 servers which does not follow options in ``Tier`` as per s3 protocol. For example: diff --git a/src/rgw/driver/rados/rgw_lc_tier.cc b/src/rgw/driver/rados/rgw_lc_tier.cc index 7c2628d1031..91ffeb5d2cf 100644 --- a/src/rgw/driver/rados/rgw_lc_tier.cc +++ b/src/rgw/driver/rados/rgw_lc_tier.cc @@ -1019,8 +1019,10 @@ int cloud_tier_restore(const DoutPrefixProvider *dpp, RGWRESTConn& dest_conn, bufferlist bl, out_bl; string resource = obj_to_aws_path(dest_obj); - const std::string tier_v = (glacier_params.glacier_restore_tier_type == GlacierRestoreTierType::Expedited) ? "Expedited" : "Standard"; - + std::optional tier_v; + if (glacier_params.glacier_restore_tier_type != GlacierRestoreTierType::NoTier) { + tier_v = (glacier_params.glacier_restore_tier_type == GlacierRestoreTierType::Expedited) ? "Expedited" : "Standard"; + } struct RestoreRequest { std::optional days; std::optional tier; diff --git a/src/rgw/driver/rados/rgw_zone.cc b/src/rgw/driver/rados/rgw_zone.cc index c71656838df..79f97aeb794 100644 --- a/src/rgw/driver/rados/rgw_zone.cc +++ b/src/rgw/driver/rados/rgw_zone.cc @@ -1537,10 +1537,12 @@ int RGWZoneGroupTierS3Glacier::update_params(const JSONFormattable& config) if (config.exists("glacier_restore_tier_type")) { string s; s = config["glacier_restore_tier_type"]; - if (s != "Expedited") { - glacier_restore_tier_type = Standard; - } else { + if (s == "Expedited") { glacier_restore_tier_type = Expedited; + } else if (s == "NoTier") { + glacier_restore_tier_type = NoTier; + } else { + glacier_restore_tier_type = Standard; } } return 0; diff --git a/src/rgw/rgw_zone.cc b/src/rgw/rgw_zone.cc index 90ff7cef106..321ad138526 100644 --- a/src/rgw/rgw_zone.cc +++ b/src/rgw/rgw_zone.cc @@ -907,7 +907,14 @@ void RGWZoneStorageClasses::decode_json(JSONObj *obj) void RGWZoneGroupTierS3Glacier::dump(Formatter *f) const { encode_json("glacier_restore_days", glacier_restore_days, f); - string s = (glacier_restore_tier_type == Standard ? "Standard" : "Expedited"); + string s; + if (glacier_restore_tier_type == Expedited) { + s = "Expedited"; + } else if (glacier_restore_tier_type == NoTier) { + s = "NoTier"; + } else { + s = "Standard"; + } encode_json("glacier_restore_tier_type", s, f); } @@ -916,10 +923,12 @@ void RGWZoneGroupTierS3Glacier::decode_json(JSONObj *obj) JSONDecoder::decode_json("glacier_restore_days", glacier_restore_days, obj); string s; JSONDecoder::decode_json("glacier_restore_tier_type", s, obj); - if (s != "Expedited") { - glacier_restore_tier_type = Standard; - } else { + if (s == "Expedited") { glacier_restore_tier_type = Expedited; + } else if (s == "NoTier") { + glacier_restore_tier_type = NoTier; + } else { + glacier_restore_tier_type = Standard; } } diff --git a/src/rgw/rgw_zone_types.h b/src/rgw/rgw_zone_types.h index d3cd73c9aa0..02fc3fe0bed 100644 --- a/src/rgw/rgw_zone_types.h +++ b/src/rgw/rgw_zone_types.h @@ -545,6 +545,7 @@ WRITE_CLASS_ENCODER(RGWZoneGroupPlacementTierS3) enum GlacierRestoreTierType : uint8_t { Standard = 0, Expedited = 1, + NoTier = 2, }; struct RGWZoneGroupTierS3Glacier { -- 2.47.3