From a504676e0b7976ebcb757471b48f8fa3b3c8f1ec Mon Sep 17 00:00:00 2001 From: yati1998 Date: Mon, 4 Nov 2024 19:38:39 +0530 Subject: [PATCH] rbd: check if mirror image has parent image 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 --- internal/rbd/mirror.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/rbd/mirror.go b/internal/rbd/mirror.go index e20927d0144..94e75dde369 100644 --- a/internal/rbd/mirror.go +++ b/internal/rbd/mirror.go @@ -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) }