]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: cannot set self as remote peer 17300/head
authorsongweibin <song.weibin@zte.com.cn>
Mon, 28 Aug 2017 08:50:58 +0000 (16:50 +0800)
committersongweibin <song.weibin@zte.com.cn>
Mon, 28 Aug 2017 12:13:19 +0000 (20:13 +0800)
Signed-off-by: songweibin <song.weibin@zte.com.cn>
src/librbd/api/Mirror.cc

index 8661e7a73a35de219e61f51ce58c6744111d56e3..5b63e0f83c031a5de7748988cecd48f07922754f 100644 (file)
@@ -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 << "': "