Skip to content

Commit

Permalink
rbd: fail DisableVolumeReplication() if image is not mirror disabled
Browse files Browse the repository at this point in the history
This commit modifies DisableVolumeReplication() to fail
if the image is not in mirror disabled state

Signed-off-by: Rakshith R <rar@redhat.com>
  • Loading branch information
Rakshith-R authored and mergify[bot] committed Sep 11, 2024
1 parent 4992644 commit 61c23dd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/rbd/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ func DisableVolumeReplication(mirror types.Mirror,
return fmt.Errorf("failed to get mirroring info of image: %w", err)
}

if info.GetState() == librbd.MirrorImageDisabling.String() {
return fmt.Errorf("%w: image is in disabling state", ErrAborted)
// error out if the image is not in disabled state.
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
Expand Down

0 comments on commit 61c23dd

Please sign in to comment.