From 56717a79ff64791aa8f6299b9118de714c764afe Mon Sep 17 00:00:00 2001 From: Ted Yu Date: Sat, 5 Oct 2019 19:34:39 -0700 Subject: [PATCH] Log the error return from store.Delete --- .../volume/persistentvolume/pv_controller_base.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/controller/volume/persistentvolume/pv_controller_base.go b/pkg/controller/volume/persistentvolume/pv_controller_base.go index d3965c1bffd..449efd7a9e9 100644 --- a/pkg/controller/volume/persistentvolume/pv_controller_base.go +++ b/pkg/controller/volume/persistentvolume/pv_controller_base.go @@ -210,8 +210,11 @@ func (ctrl *PersistentVolumeController) updateVolume(volume *v1.PersistentVolume // deleteVolume runs in worker thread and handles "volume deleted" event. func (ctrl *PersistentVolumeController) deleteVolume(volume *v1.PersistentVolume) { - _ = ctrl.volumes.store.Delete(volume) - klog.V(4).Infof("volume %q deleted", volume.Name) + if err := ctrl.volumes.store.Delete(volume); err != nil { + klog.Errorf("volume %q deletion encountered : %v", volume.Name, err) + } else { + klog.V(4).Infof("volume %q deleted", volume.Name) + } // record deletion metric if a deletion start timestamp is in the cache // the following calls will be a no-op if there is nothing for this volume in the cache // end of timestamp cache entry lifecycle, "RecordMetric" will do the clean @@ -255,7 +258,9 @@ func (ctrl *PersistentVolumeController) updateClaim(claim *v1.PersistentVolumeCl // Unit test [5-5] [5-6] [5-7] // deleteClaim runs in worker thread and handles "claim deleted" event. func (ctrl *PersistentVolumeController) deleteClaim(claim *v1.PersistentVolumeClaim) { - _ = ctrl.claims.Delete(claim) + if err := ctrl.claims.Delete(claim); err != nil { + klog.Errorf("claim %q deletion encountered : %v", claim.Name, err) + } claimKey := claimToClaimKey(claim) klog.V(4).Infof("claim %q deleted", claimKey) // clean any possible unfinished provision start timestamp from cache