Skip to content

Commit

Permalink
Merge pull request #629 from andyzhangx/no-sleep-throttling
Browse files Browse the repository at this point in the history
fix: no sleep when GetDisk is throttled
  • Loading branch information
k8s-ci-robot committed May 13, 2021
2 parents c48dea8 + 88f0b84 commit 15b9d06
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pkg/provider/azure_managedDiskController.go
Expand Up @@ -23,7 +23,6 @@ import (
"path"
"strconv"
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
"github.com/Azure/go-autorest/autorest/to"
Expand All @@ -38,8 +37,6 @@ import (
"sigs.k8s.io/cloud-provider-azure/pkg/consts"
)

const expectedDiskProvisionSeconds = 3 // seconds

//ManagedDiskController : managed disk controller struct
type ManagedDiskController struct {
common *controllerCommon
Expand Down Expand Up @@ -203,8 +200,7 @@ func (c *ManagedDiskController) CreateManagedDisk(options *ManagedDiskOptions) (
diskID := fmt.Sprintf(managedDiskPath, cloud.subscriptionID, options.ResourceGroup, options.DiskName)

if options.SkipGetDiskOperation {
klog.Warningf("azureDisk - GetDisk(%s, StorageAccountType:%s) is throttled, wait 3s for disk provisioning complete", options.DiskName, options.StorageAccountType)
time.Sleep(expectedDiskProvisionSeconds * time.Second)
klog.Warningf("azureDisk - GetDisk(%s, StorageAccountType:%s) is throttled, unable to confirm provisioningState in poll process", options.DiskName, options.StorageAccountType)
} else {
err = kwait.ExponentialBackoff(defaultBackOff, func() (bool, error) {
provisionState, id, err := c.GetDisk(options.ResourceGroup, options.DiskName)
Expand All @@ -225,8 +221,7 @@ func (c *ManagedDiskController) CreateManagedDisk(options *ManagedDiskOptions) (
})

if err != nil {
klog.Warningf("azureDisk - created new MD Name:%s StorageAccountType:%s Size:%v but was unable to confirm provisioningState in poll process, wait 3s for disk provisioning complete", options.DiskName, options.StorageAccountType, options.SizeGB)
time.Sleep(expectedDiskProvisionSeconds * time.Second)
klog.Warningf("azureDisk - created new MD Name:%s StorageAccountType:%s Size:%v but was unable to confirm provisioningState in poll process", options.DiskName, options.StorageAccountType, options.SizeGB)
}
}

Expand Down

0 comments on commit 15b9d06

Please sign in to comment.