]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
radosgw-admin: commit_period gets remote connection from new period
authorCasey Bodley <cbodley@redhat.com>
Sat, 8 Apr 2017 17:14:25 +0000 (13:14 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 3 May 2017 14:52:33 +0000 (10:52 -0400)
Fixes: http://tracker.ceph.com/issues/19554
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_admin.cc

index f51c8bad2e27ed623c85e8cf12f35d720454c769..c820802b61bb31de740b7fb2bdfb36396108ed68 100644 (file)
@@ -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<RGWRESTConn> 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;