Merge pull request #378 from Rakshith-R/BZ-mirror-check

BUG 2311885: rbd: fail DisableVolumeReplication() if image is not mirror disabled
This commit is contained in:
openshift-merge-bot[bot] 2024-09-13 01:04:09 +00:00 committed by GitHub
commit 79eb51d276
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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