summaryrefslogtreecommitdiffstats
path: root/src/librbd/api/Mirror.cc
diff options
context:
space:
mode:
authorsongweibin <song.weibin@zte.com.cn>2017-08-28 10:50:58 +0200
committersongweibin <song.weibin@zte.com.cn>2017-08-28 14:13:19 +0200
commit1dd597b1587b57a4e72edc258639db356818b8fa (patch)
tree0eba3c8f2ac25f167d9e8c5076ed09b48b352236 /src/librbd/api/Mirror.cc
parentMerge pull request #17284 from liupan1111/wip-nvme-cleanup (diff)
downloadceph-1dd597b1587b57a4e72edc258639db356818b8fa.tar.xz
ceph-1dd597b1587b57a4e72edc258639db356818b8fa.zip
librbd: cannot set self as remote peer
Signed-off-by: songweibin <song.weibin@zte.com.cn>
Diffstat (limited to 'src/librbd/api/Mirror.cc')
-rw-r--r--src/librbd/api/Mirror.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/librbd/api/Mirror.cc b/src/librbd/api/Mirror.cc
index 8661e7a73a3..5b63e0f83c0 100644
--- a/src/librbd/api/Mirror.cc
+++ b/src/librbd/api/Mirror.cc
@@ -765,6 +765,11 @@ int Mirror<I>::peer_set_cluster(librados::IoCtx& io_ctx,
ldout(cct, 20) << "uuid=" << uuid << ", "
<< "cluster=" << cluster_name << dendl;
+ if (cct->_conf->cluster == cluster_name) {
+ lderr(cct) << "cannot set self as remote peer" << dendl;
+ return -EINVAL;
+ }
+
int r = cls_client::mirror_peer_set_cluster(&io_ctx, uuid, cluster_name);
if (r < 0) {
lderr(cct) << "failed to update cluster '" << uuid << "': "