rbd: restart thick-provisioned PVC cloning after aborting

In case cloning a thick-PVC failed during DeepCopy(), the image will
exist, but have partial contents. Only when the image has the
thick-provisioned metadata set, it has completed DeepCopy().

When the metadata is missing, the image is deleted, and an error is
returned to the caller. Kubernetes will automatically retry provisioning
on the ABORTED error, and the cloning will get restarted from the
beginning.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos
2021-06-17 11:27:11 +02:00
committed by mergify[bot]
parent b1045364d9
commit 57d3183cb1
2 changed files with 24 additions and 6 deletions

View File

@ -152,8 +152,6 @@ func (rv *rbdVolume) createCloneFromImage(ctx context.Context, parentVol *rbdVol
}
defer j.Destroy()
// TODO: if rv exists, delete the image and start over?
err = rv.doSnapClone(ctx, parentVol)
if err != nil {
return status.Error(codes.Internal, err.Error())