code: func (ctrl *PersistentVolumeController) updateClaimStatusWithEvent(claim *v1.PersistentVolumeClaim, phase v1.PersistentVolumeClaimPhase, volume *v1.PersistentVolume, eventtype, reason, message string) (*v1.PersistentVolumeClaim, error) {
  	klog.V(4).Infof("updating updateClaimStatusWithEvent[%s]: set phase %s", claimToClaimKey(claim), phase)
  	if claim.Status.Phase == phase {
  		// Nothing to do.
  		klog.V(4).Infof("updating updateClaimStatusWithEvent[%s]: phase %s already set", claimToClaimKey(claim), phase)
  		return claim, nil
  	}
  
  	newClaim, err := ctrl.updateClaimStatus(claim, phase, volume)
  	if err != nil {
  		return nil, err
  	}
  
  	// Emit the event only when the status change happens, not every time
  	// syncClaim is called.
  	klog.V(3).Infof("claim %q changed status to %q: %s", claimToClaimKey(claim), phase, message)
  	ctrl.eventRecorder.Event(newClaim, eventtype, reason, message)
  
  	return newClaim, nil
  }
docs: // updateClaimStatusWithEvent saves new claim.Status to API server and emits
  // given event on the claim. It saves the status and emits the event only when
  // the status has actually changed from the version saved in API server.
  // Parameters:
  //   claim - claim to update
  //   phase - phase to set
  //   volume - volume which Capacity is set into claim.Status.Capacity
  //   eventtype, reason, message - event to send, see EventRecorder.Event()