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 5, 2024
1 parent c451997 commit a504676
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/rbd/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ 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 %q has a parent %q", ri.ImageID, ri.ParentName)
}

return fmt.Errorf("failed to enable mirroring on %q with error: %w", ri, err)
}

Expand Down

0 comments on commit a504676

Please sign in to comment.