From: Casey Bodley Date: Wed, 3 Apr 2024 20:23:53 +0000 (-0400) Subject: rgw/notify: support cross-tenant and cross-account notifications X-Git-Tag: testing/wip-yuriw-testing-20240416.150233~10^2~4 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=088f19a00280a9c48dfd4d3c3020262318e7f613;p=ceph-ci.git rgw/notify: support cross-tenant and cross-account notifications 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 (cherry picked from commit 3a5af5fdfe138f1de385f7637d04398606be4eca) --- diff --git a/src/rgw/driver/rados/rgw_notify.cc b/src/rgw/driver/rados/rgw_notify.cc index 27577bfe728..7759fce8f99 100644 --- a/src/rgw/driver/rados/rgw_notify.cc +++ b/src/rgw/driver/rados/rgw_notify.cc @@ -11,6 +11,7 @@ #include #include #include +#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) {