mirror of
https://github.com/ceph/ceph
synced 2025-04-01 23:02:17 +00:00
librbd: fixed bug in disabling non-primary image mirroring
librbd: fixed bug in disabling non-primary image mirroring Reviewed-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
commit
5e6783cce5
@ -312,14 +312,11 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_primary) {
|
if (!is_primary && !force) {
|
||||||
if (!force) {
|
|
||||||
lderr(cct) << "Mirrored image is not the primary, add force option to"
|
lderr(cct) << "Mirrored image is not the primary, add force option to"
|
||||||
" disable mirroring" << dendl;
|
" disable mirroring" << dendl;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
goto remove_mirroring_image;
|
|
||||||
}
|
|
||||||
|
|
||||||
mirror_image_internal.state = cls::rbd::MIRROR_IMAGE_STATE_DISABLING;
|
mirror_image_internal.state = cls::rbd::MIRROR_IMAGE_STATE_DISABLING;
|
||||||
r = cls_client::mirror_image_set(&ictx->md_ctx, ictx->id,
|
r = cls_client::mirror_image_set(&ictx->md_ctx, ictx->id,
|
||||||
@ -329,6 +326,10 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!is_primary) {
|
||||||
|
goto remove_mirroring_image;
|
||||||
|
}
|
||||||
|
|
||||||
r = MirroringWatcher<>::notify_image_updated(
|
r = MirroringWatcher<>::notify_image_updated(
|
||||||
ictx->md_ctx, cls::rbd::MIRROR_IMAGE_STATE_DISABLING,
|
ictx->md_ctx, cls::rbd::MIRROR_IMAGE_STATE_DISABLING,
|
||||||
ictx->id, mirror_image_internal.global_image_id);
|
ictx->id, mirror_image_internal.global_image_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user