]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: prevent adding multiple mirror peers to a single pool 13919/head
authorJason Dillaman <dillaman@redhat.com>
Fri, 10 Mar 2017 15:56:38 +0000 (10:56 -0500)
committerJason Dillaman <dillaman@redhat.com>
Sun, 12 Mar 2017 15:18:02 +0000 (11:18 -0400)
The rbd-mirror daemon does not currently support replication
from multiple peers. Until that is supported, add a temporary
restriction to prevent confusion.

Fixes: http://tracker.ceph.com/issues/19256
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/tools/rbd/action/MirrorPool.cc

index 19981cd58784f199e9dd4fe3f15e8cc5178ffe5f..d3bc63b277cda70d7c9178f26c87bd9ea62817b6 100644 (file)
@@ -528,7 +528,20 @@ int execute_peer_add(const po::variables_map &vm) {
     return r;
   }
 
+  // TODO: temporary restriction to prevent adding multiple peers
+  // until rbd-mirror daemon can properly handle the scenario
   librbd::RBD rbd;
+  std::vector<librbd::mirror_peer_t> mirror_peers;
+  r = rbd.mirror_peer_list(io_ctx, &mirror_peers);
+  if (r < 0) {
+    std::cerr << "rbd: failed to list mirror peers" << std::endl;
+    return r;
+  }
+  if (!mirror_peers.empty()) {
+    std::cerr << "rbd: multiple peers are not currently supported" << std::endl;
+    return -EINVAL;
+  }
+
   std::string uuid;
   r = rbd.mirror_peer_add(io_ctx, &uuid, remote_cluster, remote_client_name);
   if (r < 0) {