rbd: add struct to error

updating HandleParentImageExistence function
to return more details error which includes
the pool/namespace/image name

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2024-07-30 18:29:33 +02:00 committed by mergify[bot]
parent c773c98408
commit e682f2cc73

View File

@ -44,12 +44,12 @@ func (rv *rbdVolume) HandleParentImageExistence(
// it is no longer required when the live image is flattened.
err := rv.DeleteTempImage(ctx)
if err != nil {
return fmt.Errorf("failed to delete temporary rbd image: %w", err)
return fmt.Errorf("failed to delete temporary rbd image %s: %w", rv, err)
}
err = rv.flattenRbdImage(ctx, true, 0, 0)
if err != nil {
return err
return fmt.Errorf("failed to flatten image %s: %w", rv, err)
}
}
@ -61,7 +61,7 @@ func (rv *rbdVolume) HandleParentImageExistence(
parent, err := rv.getParent()
if err != nil {
return err
return fmt.Errorf("failed to get parent of image %s: %w", rv, err)
}
parentMirroringInfo, err := parent.GetMirroringInfo()
if err != nil {