From: Casey Bodley Date: Sat, 8 Apr 2017 17:14:25 +0000 (-0400) Subject: radosgw-admin: commit_period gets remote connection from new period X-Git-Tag: v12.0.3~98^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ec2a866cf7263a4fe1fc1058aa601bd5408ece2a;p=ceph.git radosgw-admin: commit_period gets remote connection from new period Fixes: http://tracker.ceph.com/issues/19554 Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index f51c8bad2e27..c820802b61bb 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -1632,6 +1632,17 @@ static int commit_period(RGWRealm& realm, RGWPeriod& period, remote = master_zone; cout << "Sending period to new master zone " << remote << std::endl; } + boost::optional conn; + RGWRESTConn *remote_conn = nullptr; + if (!remote.empty()) { + conn = get_remote_conn(store, period.get_map(), remote); + if (!conn) { + cerr << "failed to find a zone or zonegroup for remote " + << remote << std::endl; + return -ENOENT; + } + remote_conn = &*conn; + } // push period to the master with an empty period id period.set_id(""); @@ -1648,7 +1659,7 @@ static int commit_period(RGWRealm& realm, RGWPeriod& period, jf.flush(bl); JSONParser p; - int ret = send_to_remote_or_url(nullptr, url, access, secret, info, bl, p); + int ret = send_to_remote_or_url(remote_conn, url, access, secret, info, bl, p); if (ret < 0) { cerr << "request failed: " << cpp_strerror(-ret) << std::endl;