From a5b121724d62235a58540ce9cb256a35a3433504 Mon Sep 17 00:00:00 2001 From: hzxuzhonghu Date: Tue, 27 Mar 2018 20:00:45 +0800 Subject: [PATCH] pv controller clean code --- .../volume/persistentvolume/pv_controller.go | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/pkg/controller/volume/persistentvolume/pv_controller.go b/pkg/controller/volume/persistentvolume/pv_controller.go index c245fb15bb9..137870d2735 100644 --- a/pkg/controller/volume/persistentvolume/pv_controller.go +++ b/pkg/controller/volume/persistentvolume/pv_controller.go @@ -1045,12 +1045,7 @@ func (ctrl *PersistentVolumeController) reclaimVolume(volume *v1.PersistentVolum // doRerecycleVolumeOperationcycleVolume recycles a volume. This method is // running in standalone goroutine and already has all necessary locks. -func (ctrl *PersistentVolumeController) recycleVolumeOperation(arg interface{}) { - volume, ok := arg.(*v1.PersistentVolume) - if !ok { - glog.Errorf("Cannot convert recycleVolumeOperation argument to volume, got %#v", arg) - return - } +func (ctrl *PersistentVolumeController) recycleVolumeOperation(volume *v1.PersistentVolume) { glog.V(4).Infof("recycleVolumeOperation [%s] started", volume.Name) // This method may have been waiting for a volume lock for some time. @@ -1134,13 +1129,7 @@ func (ctrl *PersistentVolumeController) recycleVolumeOperation(arg interface{}) // deleteVolumeOperation deletes a volume. This method is running in standalone // goroutine and already has all necessary locks. -func (ctrl *PersistentVolumeController) deleteVolumeOperation(arg interface{}) error { - volume, ok := arg.(*v1.PersistentVolume) - if !ok { - glog.Errorf("Cannot convert deleteVolumeOperation argument to volume, got %#v", arg) - return nil - } - +func (ctrl *PersistentVolumeController) deleteVolumeOperation(volume *v1.PersistentVolume) error { glog.V(4).Infof("deleteVolumeOperation [%s] started", volume.Name) // This method may have been waiting for a volume lock for some time. @@ -1331,13 +1320,7 @@ func (ctrl *PersistentVolumeController) provisionClaim(claim *v1.PersistentVolum // provisionClaimOperation provisions a volume. This method is running in // standalone goroutine and already has all necessary locks. -func (ctrl *PersistentVolumeController) provisionClaimOperation(claimObj interface{}) { - claim, ok := claimObj.(*v1.PersistentVolumeClaim) - if !ok { - glog.Errorf("Cannot convert provisionClaimOperation argument to claim, got %#v", claimObj) - return - } - +func (ctrl *PersistentVolumeController) provisionClaimOperation(claim *v1.PersistentVolumeClaim) { claimClass := v1helper.GetPersistentVolumeClaimClass(claim) glog.V(4).Infof("provisionClaimOperation [%s] started, class: %q", claimToClaimKey(claim), claimClass)