From: Jason Dillaman Date: Wed, 15 Apr 2020 19:21:55 +0000 (-0400) Subject: rbd: improved error message when adding a duplicate mirror pool peer X-Git-Tag: v15.2.2~64^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=390504666f13bf3fc8b9b816ab87b29cc89f010f;p=ceph.git rbd: improved error message when adding a duplicate mirror pool peer Signed-off-by: Jason Dillaman (cherry picked from commit 74cded6b0de90660db46d0dea0cd35ca0bba563e) --- diff --git a/src/tools/rbd/action/MirrorPool.cc b/src/tools/rbd/action/MirrorPool.cc index bfdc63627a252..603e0f0f014ec 100644 --- a/src/tools/rbd/action/MirrorPool.cc +++ b/src/tools/rbd/action/MirrorPool.cc @@ -1042,7 +1042,10 @@ int execute_peer_add(const po::variables_map &vm, std::string uuid; r = rbd.mirror_peer_site_add( io_ctx, &uuid, mirror_peer_direction, remote_cluster, remote_client_name); - if (r < 0) { + if (r == -EEXIST) { + std::cerr << "rbd: mirror peer already exists" << std::endl; + return r; + } else if (r < 0) { std::cerr << "rbd: error adding mirror peer" << std::endl; return r; }