From e9a6ec29a0820dae63ce7126735b8f82aacc1744 Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Thu, 19 May 2016 14:00:16 +0200 Subject: [PATCH] volume controller: use better operation names Using volume/claim.UID in the operation name is not really useful, as UIDs are not logged by rest of the controller. On the other hand, volume.Name and claim.Namespace/Name is logged pretty often and it would help to log these also in operation name. This has been already proven to be very useful in controller debugging. --- pkg/controller/persistentvolume/controller.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/controller/persistentvolume/controller.go b/pkg/controller/persistentvolume/controller.go index e61a30baa65..790f5a71faf 100644 --- a/pkg/controller/persistentvolume/controller.go +++ b/pkg/controller/persistentvolume/controller.go @@ -802,11 +802,13 @@ func (ctrl *PersistentVolumeController) reclaimVolume(volume *api.PersistentVolu case api.PersistentVolumeReclaimRecycle: glog.V(4).Infof("reclaimVolume[%s]: policy is Recycle", volume.Name) - ctrl.scheduleOperation("recycle-"+string(volume.UID), ctrl.recycleVolumeOperation, volume) + opName := fmt.Sprintf("recycle-%s[%s]", volume.Name, string(volume.UID)) + ctrl.scheduleOperation(opName, ctrl.recycleVolumeOperation, volume) case api.PersistentVolumeReclaimDelete: glog.V(4).Infof("reclaimVolume[%s]: policy is Delete", volume.Name) - ctrl.scheduleOperation("delete-"+string(volume.UID), ctrl.deleteVolumeOperation, volume) + opName := fmt.Sprintf("delete-%s[%s]", volume.Name, string(volume.UID)) + ctrl.scheduleOperation(opName, ctrl.deleteVolumeOperation, volume) default: // Unknown PersistentVolumeReclaimPolicy @@ -1032,7 +1034,8 @@ func (ctrl *PersistentVolumeController) doDeleteVolume(volume *api.PersistentVol // provisionClaim starts new asynchronous operation to provision a claim. func (ctrl *PersistentVolumeController) provisionClaim(claim *api.PersistentVolumeClaim) error { glog.V(4).Infof("provisionClaim[%s]: started", claimToClaimKey(claim)) - ctrl.scheduleOperation("provision-"+string(claim.UID), ctrl.provisionClaimOperation, claim) + opName := fmt.Sprintf("provision-%s[%s]", claimToClaimKey(claim), string(claim.UID)) + ctrl.scheduleOperation(opName, ctrl.provisionClaimOperation, claim) return nil }