]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/logging: source and log bucket must be different
authorYuval Lifshitz <ylifshit@ibm.com>
Thu, 19 Dec 2024 11:54:54 +0000 (11:54 +0000)
committerYuval Lifshitz <ylifshit@ibm.com>
Mon, 13 Jan 2025 06:38:49 +0000 (06:38 +0000)
Signed-off-by: Yuval Lifshitz <ylifshit@ibm.com>
doc/radosgw/bucket_logging.rst
src/rgw/rgw_rest_bucket_logging.cc

index 1ac4e546a4c7ab3c82b85f6b024966f456f0e323..df469497383d71810cad460412f6a5a5892af9ce 100644 (file)
@@ -15,6 +15,12 @@ The log bucket can accumulate logs from multiple buckets. It is recommended to c
 a different "prefix" for each bucket, so that the logs of different buckets will be stored
 in different objects in the log bucket.
 
+.. note::
+
+    - The log bucket must be created before enabling logging on a bucket
+    - The log bucket cannot be the same as the bucket being logged
+    - The log bucket cannot have logging enabled on it
+
 
 .. toctree::
    :maxdepth: 1
index 0e7b53120db73fdf3fb20da68d6f45fe811d008a..5689a7acc5687cc6270b6f2ecb631e3f85c82aa8 100644 (file)
@@ -181,6 +181,11 @@ class RGWPutBucketLoggingOp : public RGWDefaultResponseOp {
         return;
       }
       const rgw_bucket target_bucket_id(target_tenant_name, target_bucket_name);
+      if (target_bucket_id == src_bucket_id) {
+        ldpp_dout(this, 1) << "ERROR: target bucket '" << target_bucket_id << "' must be different from source bucket" << dendl;
+        op_ret = -EINVAL;
+        return;
+      }
       std::unique_ptr<rgw::sal::Bucket> target_bucket;
       op_ret = driver->load_bucket(this, target_bucket_id,
                                    &target_bucket, y);