]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgwlc: update LCFilter::dump_xml(...) to add flags/ArchiveZone
authorMatt Benjamin <mbenjamin@redhat.com>
Thu, 7 Jul 2022 21:29:27 +0000 (17:29 -0400)
committerMykola Golub <mgolub@suse.com>
Tue, 12 Dec 2023 10:15:33 +0000 (12:15 +0200)
Also updates the location of Prefix, which is supposed to *generate*
as <Filter><Prefix/></Filter>, regardless of how we parsed it.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
(cherry picked from commit 313a8a4db76842385a2da873832282fca2434c01)

src/rgw/rgw_lc.cc
src/rgw/rgw_lc.h
src/rgw/rgw_lc_s3.cc

index 90af3ab9195f9dbc76f0249d8489677d077457b4..798032c8fe4038b9440da7d2a3022d178f88f386 100644 (file)
@@ -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
index d796714564831f6ddde90463cd64188eb500eb1f..a0f888fcc985cbdf6449b2d10e6896bffde015c8 100644 (file)
@@ -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);
index b815a6ecc6adf298f950d6ec4c558662d3245036..cf152b84a84c61d315a656166cd125981697fd6e 100644 (file)
@@ -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<const RGWObjTagSet_S3 &>(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
   }
 }