From deaff8cb5d60863ec74a58f1fa164d1ac7c02323 Mon Sep 17 00:00:00 2001 From: Shilpa Jagannath Date: Thu, 18 Sep 2025 16:37:18 -0400 Subject: [PATCH] rgw/multisite: empty realm_id and period_id passed into do_period_pull() was causing remote zone to respond with 404 error during a period pull. Signed-off-by: Shilpa Jagannath --- src/rgw/radosgw-admin/radosgw-admin.cc | 43 +++++++------------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/src/rgw/radosgw-admin/radosgw-admin.cc b/src/rgw/radosgw-admin/radosgw-admin.cc index 4f4bb112063..45ec24093a5 100644 --- a/src/rgw/radosgw-admin/radosgw-admin.cc +++ b/src/rgw/radosgw-admin/radosgw-admin.cc @@ -4883,41 +4883,22 @@ int main(int argc, const char **argv) break; case OPT::PERIOD_PULL: { - boost::optional conn; - RGWRESTConn *remote_conn = nullptr; if (url.empty()) { - // load current period for endpoints - RGWRealm realm; - int ret = rgw::read_realm(dpp(), null_yield, cfgstore.get(), - realm_id, realm_name, realm); - if (ret < 0 ) { - cerr << "failed to load realm: " << cpp_strerror(-ret) << std::endl; - return -ret; - } - period_id = realm.current_period; - - RGWPeriod current_period; - ret = cfgstore->read_period(dpp(), null_yield, period_id, - std::nullopt, current_period); - if (ret < 0) { - cerr << "failed to load current period: " << cpp_strerror(-ret) << std::endl; - return -ret; - } - if (remote.empty()) { - // use realm master zone as remote - remote = current_period.get_master_zone().id; - } - conn = get_remote_conn(static_cast(driver), current_period.get_map(), remote); - if (!conn) { - cerr << "failed to find a zone or zonegroup for remote " - << remote << std::endl; - return -ENOENT; - } - remote_conn = &*conn; + cerr << "A --url must be provided." << std::endl; + return EINVAL; + } + // load realm for current period + RGWRealm realm; + int ret = rgw::read_realm(dpp(), null_yield, cfgstore.get(), + realm_id, realm_name, realm); + if (ret < 0 ) { + cerr << "failed to load realm: " << cpp_strerror(-ret) << std::endl; + return -ret; } + period_id = realm.current_period; RGWPeriod period; - int ret = do_period_pull(cfgstore.get(), remote_conn, url, + ret = do_period_pull(cfgstore.get(), nullptr, url, opt_region, access_key, secret_key, realm_id, realm_name, period_id, period_epoch, &period); -- 2.39.5