]> 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)
committerMatt Benjamin <mbenjamin@redhat.com>
Sun, 17 Jul 2022 22:38:07 +0000 (18:38 -0400)
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>
src/rgw/rgw_lc.cc
src/rgw/rgw_lc.h
src/rgw/rgw_lc_s3.cc

index 9233a442b4f8bf442bb25a333ca45f4b2ce3eb25..dcb2eb290400fc0bda880aa342ebabcb86cf33ed 100644 (file)
@@ -2807,6 +2807,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 3daa6e1aade0451913a3ca5c37738dc71aa9788d..3cf3931fdebe5ce28d618a0140980165502f7081 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
   }
 }