From: Jason Dillaman Date: Fri, 10 Mar 2017 15:56:38 +0000 (-0500) Subject: rbd: prevent adding multiple mirror peers to a single pool X-Git-Tag: v11.2.1~153^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=551ce273a132d4e7b59b818377568d40cf597f85;p=ceph.git rbd: prevent adding multiple mirror peers to a single pool 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 (cherry picked from commit c0c9d1014d57b3d5b95e7513fcc38d04b9ea5165) --- diff --git a/src/tools/rbd/action/MirrorPool.cc b/src/tools/rbd/action/MirrorPool.cc index 4552db9b05cbf..0c31c4e3f11dd 100644 --- a/src/tools/rbd/action/MirrorPool.cc +++ b/src/tools/rbd/action/MirrorPool.cc @@ -153,7 +153,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 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) {