From 6f09c2795075d847879bc03230bb018ce0bd64b3 Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Thu, 7 Jul 2022 17:29:27 -0400 Subject: [PATCH] rgwlc: update LCFilter::dump_xml(...) to add flags/ArchiveZone Also updates the location of Prefix, which is supposed to *generate* as , regardless of how we parsed it. Signed-off-by: Matt Benjamin (cherry picked from commit 313a8a4db76842385a2da873832282fca2434c01) --- src/rgw/rgw_lc.cc | 3 +++ src/rgw/rgw_lc.h | 12 ++++++++++-- src/rgw/rgw_lc_s3.cc | 13 +++++++++---- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index 90af3ab9195..798032c8fe4 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -2774,6 +2774,9 @@ void LCFilter::dump(Formatter *f) const { f->dump_string("prefix", prefix); f->dump_object("obj_tags", obj_tags); + if (have_flag(LCFlagType::ArchiveZone)) { + f->dump_string("archivezone", ""); + } } void LCExpiration::dump(Formatter *f) const diff --git a/src/rgw/rgw_lc.h b/src/rgw/rgw_lc.h index d7967145648..a0f888fcc98 100644 --- a/src/rgw/rgw_lc.h +++ b/src/rgw/rgw_lc.h @@ -218,12 +218,12 @@ public: } bool empty() const { - return !(has_prefix() || has_tags()); + return !(has_prefix() || has_tags() || has_flags()); } // Determine if we need AND tag when creating xml bool has_multi_condition() const { - if (obj_tags.count() > 1) + if (obj_tags.count() + int(has_prefix()) > 1) // Prefix is a member of Filter return true; return false; } @@ -236,6 +236,14 @@ public: return !obj_tags.empty(); } + bool has_flags() const { + return !(flags == uint32_t(LCFlagType::none)); + } + + bool have_flag(LCFlagType flag) const { + return flags & make_flag(flag); + } + void encode(bufferlist& bl) const { ENCODE_START(3, 1, bl); encode(prefix, bl); diff --git a/src/rgw/rgw_lc_s3.cc b/src/rgw/rgw_lc_s3.cc index b815a6ecc6a..cf152b84a84 100644 --- a/src/rgw/rgw_lc_s3.cc +++ b/src/rgw/rgw_lc_s3.cc @@ -112,19 +112,24 @@ void RGWLifecycleConfiguration_S3::decode_xml(XMLObj *obj) void LCFilter_S3::dump_xml(Formatter *f) const { - if (has_prefix()) { - encode_xml("Prefix", prefix, f); - } bool multi = has_multi_condition(); if (multi) { f->open_array_section("And"); } + if (has_prefix()) { + encode_xml("Prefix", prefix, f); + } if (has_tags()) { const auto& tagset_s3 = static_cast(obj_tags); tagset_s3.dump_xml(f); } + if (has_flags()) { + if (have_flag(LCFlagType::ArchiveZone)) { + encode_xml("ArchiveZone", "", f); + } + } if (multi) { - f->close_section(); + f->close_section(); // And } } -- 2.47.3