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>
(cherry picked from commit
c0c9d1014d57b3d5b95e7513fcc38d04b9ea5165)
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) {