From: Matt Benjamin Date: Thu, 7 Jul 2022 21:29:27 +0000 (-0400) Subject: rgwlc: update LCFilter::dump_xml(...) to add flags/ArchiveZone X-Git-Tag: v17.2.8~130^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6f09c2795075d847879bc03230bb018ce0bd64b3;p=ceph.git 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) --- 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 } }