mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
rbd: fail DisableVolumeReplication() if image is not mirror disabled
This commit modifies DisableVolumeReplication() to fail if the image is not in mirror disabled state Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
parent
49926446f9
commit
61c23dd4d2
@ -90,8 +90,10 @@ func DisableVolumeReplication(mirror types.Mirror,
|
|||||||
return fmt.Errorf("failed to get mirroring info of image: %w", err)
|
return fmt.Errorf("failed to get mirroring info of image: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if info.GetState() == librbd.MirrorImageDisabling.String() {
|
// error out if the image is not in disabled state.
|
||||||
return fmt.Errorf("%w: image is in disabling state", ErrAborted)
|
if info.GetState() != librbd.MirrorImageDisabled.String() {
|
||||||
|
return fmt.Errorf("%w: image is in %q state, expected state %q", ErrAborted,
|
||||||
|
info.GetState(), librbd.MirrorImageDisabled.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user