rbd: cleanup volume info from group even if image is not part of group

we should continue to cleanup the volume info like the
omap data, mappings from the group if the image is not
part of the goup anymore.

Signed-off-by: Nikhil-Ladha <nikhilladha1999@gmail.com>
This commit is contained in:
Nikhil-Ladha 2025-04-01 12:28:30 +05:30 committed by mergify[bot]
parent 2fe7dbe2af
commit 23fce43925

View File

@ -255,11 +255,10 @@ func (vg *volumeGroup) RemoveVolume(ctx context.Context, vol types.Volume) error
err := vol.RemoveFromGroup(ctx, vg)
if err != nil {
if errors.Is(err, librbd.ErrNotExist) {
return nil
if !errors.Is(err, librbd.ErrNotExist) {
return fmt.Errorf("failed to remove volume %q from volume group %q: %w", vol, vg, err)
}
return fmt.Errorf("failed to remove volume %q from volume group %q: %w", vol, vg, err)
log.DebugLog(ctx, "volume %q doesn't exist in group", vol)
}
// toRemove contain the ID of the volume that is removed from the group