summaryrefslogtreecommitdiffstats
path: root/src/librbd/api/Mirror.cc
diff options
context:
space:
mode:
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 << "': "