Skip to content

Commit

Permalink
rbd: check if mirror image has parent image
Browse files Browse the repository at this point in the history
since enable mirroring fails if it has parent image
this commit adds a check for that and returns
suitable error which can be picke by VR status

Signed-off-by: yati1998 <[email protected]>
  • Loading branch information
yati1998 committed Nov 4, 2024
1 parent f4f0304 commit e705a2b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/rbd/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ func (ri *rbdImage) EnableMirroring(_ context.Context, mode librbd.ImageMirrorMo

err = image.MirrorEnable(mode)
if err != nil {
if ri.ParentName != "" {
return fmt.Errorf("failed to enable mirroring as image has a parent")
}
return fmt.Errorf("failed to enable mirroring on %q with error: %w", ri, err)
}

Expand Down

0 comments on commit e705a2b

Please sign in to comment.