]> 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>
Wed, 10 Apr 2024 17:09:18 +0000 (13:09 -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>
src/rgw/driver/rados/rgw_notify.cc

index 11623dd48f8bb68f69cbc72561968397691017ef..6000bb8d1177ff13ec4269e15560b60195bbc379 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"
@@ -1040,7 +1041,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) {