Skip to content

Commit

Permalink
Merge pull request #17300 from Songweibin/wip-mirror-peer-set
Browse files Browse the repository at this point in the history
librbd: should not set self as remote peer

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
  • Loading branch information
Jason Dillaman committed Sep 7, 2017
2 parents 9cde1ab + 1dd597b commit 5995bca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/librbd/api/Mirror.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 << "': "
Expand Down

0 comments on commit 5995bca

Please sign in to comment.