From a5cde1a463d49fe6f793d49a74ed7f13e2f1c4a3 Mon Sep 17 00:00:00 2001 From: houjun Date: Tue, 21 Aug 2018 11:50:16 +0800 Subject: [PATCH] Check for pvcVolume with IsOperationPending() before markPVCResizeInProgress() --- pkg/controller/volume/expand/sync_volume_resize.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/controller/volume/expand/sync_volume_resize.go b/pkg/controller/volume/expand/sync_volume_resize.go index c355a967472..b59ff845ec4 100644 --- a/pkg/controller/volume/expand/sync_volume_resize.go +++ b/pkg/controller/volume/expand/sync_volume_resize.go @@ -64,6 +64,11 @@ func (rc *syncResize) Sync() { // Resize PVCs that require resize for _, pvcWithResizeRequest := range rc.resizeMap.GetPVCsWithResizeRequest() { uniqueVolumeKey := v1.UniqueVolumeName(pvcWithResizeRequest.UniquePVCKey()) + if rc.opsExecutor.IsOperationPending(uniqueVolumeKey, "") { + klog.V(10).Infof("Operation for PVC %s is already pending", pvcWithResizeRequest.QualifiedName()) + continue + } + updatedClaim, err := markPVCResizeInProgress(pvcWithResizeRequest, rc.kubeClient) if err != nil { klog.V(5).Infof("Error setting PVC %s in progress with error : %v", pvcWithResizeRequest.QualifiedName(), err) @@ -73,10 +78,6 @@ func (rc *syncResize) Sync() { pvcWithResizeRequest.PVC = updatedClaim } - if rc.opsExecutor.IsOperationPending(uniqueVolumeKey, "") { - klog.V(10).Infof("Operation for PVC %v is already pending", pvcWithResizeRequest.QualifiedName()) - continue - } growFuncError := rc.opsExecutor.ExpandVolume(pvcWithResizeRequest, rc.resizeMap) if growFuncError != nil && !exponentialbackoff.IsExponentialBackoff(growFuncError) { klog.Errorf("Error growing pvc %s with %v", pvcWithResizeRequest.QualifiedName(), growFuncError)