Skip to content

Commit cf56673

Browse files
authored
Merge pull request ceph#65593 from smanjara/wip-fix-period-pull
rgw/multisite: fix period pull command
2 parents ba4403a + deaff8c commit cf56673

File tree

1 file changed

+12
-31
lines changed

1 file changed

+12
-31
lines changed

src/rgw/radosgw-admin/radosgw-admin.cc

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4883,41 +4883,22 @@ int main(int argc, const char **argv)
48834883
break;
48844884
case OPT::PERIOD_PULL:
48854885
{
4886-
boost::optional<RGWRESTConn> conn;
4887-
RGWRESTConn *remote_conn = nullptr;
48884886
if (url.empty()) {
4889-
// load current period for endpoints
4890-
RGWRealm realm;
4891-
int ret = rgw::read_realm(dpp(), null_yield, cfgstore.get(),
4892-
realm_id, realm_name, realm);
4893-
if (ret < 0 ) {
4894-
cerr << "failed to load realm: " << cpp_strerror(-ret) << std::endl;
4895-
return -ret;
4896-
}
4897-
period_id = realm.current_period;
4898-
4899-
RGWPeriod current_period;
4900-
ret = cfgstore->read_period(dpp(), null_yield, period_id,
4901-
std::nullopt, current_period);
4902-
if (ret < 0) {
4903-
cerr << "failed to load current period: " << cpp_strerror(-ret) << std::endl;
4904-
return -ret;
4905-
}
4906-
if (remote.empty()) {
4907-
// use realm master zone as remote
4908-
remote = current_period.get_master_zone().id;
4909-
}
4910-
conn = get_remote_conn(static_cast<rgw::sal::RadosStore*>(driver), current_period.get_map(), remote);
4911-
if (!conn) {
4912-
cerr << "failed to find a zone or zonegroup for remote "
4913-
<< remote << std::endl;
4914-
return -ENOENT;
4915-
}
4916-
remote_conn = &*conn;
4887+
cerr << "A --url must be provided." << std::endl;
4888+
return EINVAL;
4889+
}
4890+
// load realm for current period
4891+
RGWRealm realm;
4892+
int ret = rgw::read_realm(dpp(), null_yield, cfgstore.get(),
4893+
realm_id, realm_name, realm);
4894+
if (ret < 0 ) {
4895+
cerr << "failed to load realm: " << cpp_strerror(-ret) << std::endl;
4896+
return -ret;
49174897
}
4898+
period_id = realm.current_period;
49184899

49194900
RGWPeriod period;
4920-
int ret = do_period_pull(cfgstore.get(), remote_conn, url,
4901+
ret = do_period_pull(cfgstore.get(), nullptr, url,
49214902
opt_region, access_key, secret_key,
49224903
realm_id, realm_name, period_id, period_epoch,
49234904
&period);

0 commit comments

Comments
 (0)