In case if group belongs to non-default namespace, the mirror daemon on
secondary is setting an empty mirror peer uuid on non primary demote snapshot.
And when previous secondary turns into primary (by an explicit promote request)
the previous i.e. non primary demote snapshot is getting unlinked as part of
the promote request as there is no mirror peer uuid set on it. Because the
previous dependent snapshot is removed, there are split-brain errors leading
to recent test failures.
This fix makesure to set the right mirror peer uuid on the non primary demote
snapshot even if the group belong to non-default namespace.
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
int r;
std::set<std::string> mirror_peer_uuids;
if (snap_state == cls::rbd::MIRROR_SNAPSHOT_STATE_NON_PRIMARY_DEMOTED) {
+ librados::IoCtx default_ns_io_ctx;
+ default_ns_io_ctx.dup(m_local_io_ctx);
+ default_ns_io_ctx.set_namespace("");
std::vector<cls::rbd::MirrorPeer> mirror_peers;
- r = librbd::cls_client::mirror_peer_list(&m_local_io_ctx, &mirror_peers);
+ r = librbd::cls_client::mirror_peer_list(&default_ns_io_ctx, &mirror_peers);
if (r < 0) {
- derr << "failed to list peers: " << cpp_strerror(r) << dendl;
+ derr << "failed to list mirror peers: " << cpp_strerror(r) << dendl;
+ locker.unlock();
+ on_finish->complete(r);
+ return;
}
for (auto &peer : mirror_peers) {