@@ -239,10 +239,10 @@ func (s *DeviceState) Unprepare(ctx context.Context, claimRef kubeletplugin.Name
239239 claimRef .Name ,
240240 metav1.GetOptions {})
241241
242+ // TODO: distinguish errors -- if this is a 'not found' error then this
243+ // is permanent and we may want to drop the claim from the checkpoint.
244+ // Otherwise, this might be worth retrying?
242245 if err != nil {
243- // TODO: distinguish errors -- if this is a 'not found' error then
244- // this is permanent and we may want to drop the claim from the
245- // checkpoint. Otherwise, this might be worth retrying?
246246 return permanentError {fmt .Errorf ("failed to fetch ResourceClaim %s: %w" , claimRef .String (), err )}
247247 }
248248 if claim .Status .Allocation == nil {
@@ -261,10 +261,9 @@ func (s *DeviceState) Unprepare(ctx context.Context, claimRef kubeletplugin.Name
261261 return fmt .Errorf ("unsupported ClaimCheckpointState: %v" , pc .CheckpointState )
262262 }
263263
264+ // Assume that this is a retryable error. If there is any chance for this
265+ // error to be permanent: drop the claim from checkpoint then regardless?
264266 if err := s .cdi .DeleteClaimSpecFileIfExists (claimUID ); err != nil {
265- // Assume that this is a retryable error. If there is any chance for
266- // this error to be permanent: drop the claim from checkpoint then
267- // regardless?
268267 return fmt .Errorf ("unable to delete CDI spec file for claim: %w" , err )
269268 }
270269
@@ -294,7 +293,7 @@ func (s *DeviceState) getCheckpoint() (*Checkpoint, error) {
294293// read-mutate-write sequence must be performed under a lock: we must be
295294// conceptually certain that multiple read-mutate-write actions never overlap.
296295// Currently, it is assumed that any caller gets here by first acquiring
297- // driver's `pulock`.`
296+ // driver's `pulock`.
298297func (s * DeviceState ) updateCheckpoint (mutate func (* Checkpoint )) error {
299298 checkpoint , err := s .getCheckpoint ()
300299 if err != nil {
0 commit comments