-
Notifications
You must be signed in to change notification settings - Fork 554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rbd: check if mirror image has parent image #4941
Conversation
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]>
e705a2b
to
a504676
Compare
@yati1998, parent image check is already handled in ceph-csi/internal/csi-addons/rbd/replication.go Lines 309 to 322 in c4a1e3a
|
okay, missed it, it seems we need to skip returning grpc error and instead return some meaningful error |
gRPC functions should return a gRPC error witch |
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't forget to include the original error too
I dont think this change is required as parent existence check it anyways verified. |
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