]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/notify: support cross-tenant and cross-account notifications
authorCasey Bodley <cbodley@redhat.com>
Wed, 3 Apr 2024 20:23:53 +0000 (16:23 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 12 Apr 2024 19:34:30 +0000 (15:34 -0400)
a bucket's notification configuration may refer to topics from several
different tenants or accounts. when publishing to a given topic, look in
the correct namespace for each topic instead of defaulting to the
requesting user's tenant namespace

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 3a5af5fdfe138f1de385f7637d04398606be4eca)

src/rgw/driver/rados/rgw_notify.cc

index 27577bfe7282327e8d68e8359bd0fedbbcf0c670..7759fce8f99dcba7b2f7be596b18e2fe21b03772 100644 (file)
@@ -11,6 +11,7 @@
 #include <boost/asio/io_context.hpp>
 #include <boost/context/protected_fixedsize_stack.hpp>
 #include <spawn/spawn.hpp>
+#include "include/function2.hpp"
 #include "rgw_sal_rados.h"
 #include "rgw_pubsub.h"
 #include "rgw_pubsub_push.h"
@@ -1018,7 +1019,11 @@ int publish_reserve(const DoutPrefixProvider* dpp,
           << dendl;
 
       // reload the topic in case it changed since the notification was added
-      const RGWPubSub ps(res.store, res.user_tenant, site);
+      const std::string& topic_tenant = std::visit(fu2::overload(
+          [] (const rgw_user& u) -> const std::string& { return u.tenant; },
+          [] (const rgw_account_id& a) -> const std::string& { return a; }
+          ), topic_cfg.owner);
+      const RGWPubSub ps(res.store, topic_tenant, site);
       int ret = ps.get_topic(res.dpp, topic_cfg.dest.arn_topic,
                              topic_cfg, res.yield, nullptr);
       if (ret < 0) {