rbd: return gRPC code Aborted when the RBD-image is in-use on delete

According to the error scheme documented in the CSI specification, the
Aborted error code should be initiate retries, whereas the Internal
error code does not require this behaviour.

When an RBD-image is still in-use, it can not be removed. The
DeleteVolume procedure should be retried and will succeed once the
RBD-image is not in-use anymore.

Fixes: #5166
Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos 2025-02-20 14:04:41 +01:00 committed by mergify[bot]
parent ac8cda5e37
commit 43b150f14d

View File

@ -1067,7 +1067,7 @@ func cleanupRBDImage(ctx context.Context,
if inUse {
log.ErrorLog(ctx, "rbd %s is still being used", rbdVol)
return nil, status.Errorf(codes.Internal, "rbd %s is still being used", rbdVol.RbdImageName)
return nil, status.Errorf(codes.Aborted, "rbd %s is still being used", rbdVol.RbdImageName)
}
// delete the temporary rbd image created as part of volume clone during