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 <[email protected]>
(cherry picked from commit 61c23dd)
  • Loading branch information
Rakshith-R committed Sep 12, 2024
1 parent ffd92a4 commit 431f1c3
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 @@ -89,8 +89,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 431f1c3

Please sign in to comment.