]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw/storage class. Don't inherit storage class for copy object.
authorMarcus Watts <mwatts@redhat.com>
Wed, 28 Aug 2024 21:21:13 +0000 (17:21 -0400)
committerThomas Serlin <tserlin@redhat.com>
Mon, 22 Sep 2025 19:18:18 +0000 (15:18 -0400)
When an object is copied, it should only be depending on data
in the request to determine the storage class, and if it is
not specified, it should default to 'STANDARD'.  In radosgw,
this means that this is another attribute (similar to encryption)
that should not be merged from the source object.

Fixes: https://tracker.ceph.com/issues/67787
Signed-off-by: Marcus Watts <mwatts@redhat.com>
(cherry picked from commit a0e60bda70d4af93aa545a3fdea46eb9e68088c4)

Resolves: rhbz#2300284

src/rgw/rgw_op.cc

index f8f4c048baf64aa4056365201f77db5cc68d74f5..66264abfbfe707c636f92973778b76b1fbf4c060 100644 (file)
@@ -6016,6 +6016,7 @@ class RGWCOE_make_filter_pipeline : public rgw::sal::ObjectFilter {
   std::unique_ptr<RGWGetObj_Filter> cb;
   std::map<std::string, ceph::buffer::list> src_attrs;
   std::map<std::string, ceph::buffer::list> enc_attrs;
+  bufferlist requested_sc;
   bool skip_decrypt;
   DoutPrefixProvider *dpp;
   boost::optional<RGWGetObj_Decompress> decompress;
@@ -6180,6 +6181,10 @@ ldpp_dout(dpp, 0) << "TEMP: end_x=" << end_x << " obj_size=" << obj_size << dend
     // we need it to be just the requested settings
     clear_encryption_attrs(attrs);
     merge_attrs(enc_attrs, attrs);     // request & bucket encryption defaults
+    attrs.erase(RGW_ATTR_STORAGE_CLASS);       // do not inherit from source
+    if (requested_sc.length() > 0) {
+      attrs[RGW_ATTR_STORAGE_CLASS] = std::move(requested_sc);
+    }
     attrs.erase(RGW_ATTR_COMPRESSION); // only true source: zone data
     op_ret = get_encrypt_filter(&encrypt, filter);
     if (op_ret < 0) {
@@ -6213,6 +6218,10 @@ ldpp_dout(dpp, 0) << "TEMP: end_x=" << end_x << " obj_size=" << obj_size << dend
   void set_src_attrs(std::map<std::string, ceph::buffer::list> &_src) override {
     src_attrs = filter_encryption_compression_attrs(_src, true);
     enc_attrs = filter_encryption_compression_attrs(attrs, false);
+    auto iter = attrs.find(RGW_ATTR_STORAGE_CLASS);
+    if (iter != attrs.end()) {
+      requested_sc.append(iter->second);
+    }
   };
   bool need_copy_data() override {
     return rgw_need_copy_data( src_attrs, s );