From 2a401c7ec7e37f5013098b4da30dc6b908092922 Mon Sep 17 00:00:00 2001 From: Kai Chen Date: Wed, 3 Jan 2018 12:34:15 -0800 Subject: [PATCH] Improve comments for Azure Blob Disk Controller --- .../azure/azure_blobDiskController.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/cloudprovider/providers/azure/azure_blobDiskController.go b/pkg/cloudprovider/providers/azure/azure_blobDiskController.go index 5a8e7058a0..1fa074d5bb 100644 --- a/pkg/cloudprovider/providers/azure/azure_blobDiskController.go +++ b/pkg/cloudprovider/providers/azure/azure_blobDiskController.go @@ -303,7 +303,7 @@ func (c *BlobDiskController) DeleteBlobDisk(diskURI string) error { func (c *BlobDiskController) setUniqueStrings() { uniqueString := c.common.resourceGroup + c.common.location + c.common.subscriptionID hash := MakeCRC32(uniqueString) - //used to generate a unqie container name used by this cluster PVC + //used to generate a unique container name used by this cluster PVC defaultContainerName = hash storageAccountNamePrefix = fmt.Sprintf(storageAccountNameTemplate, hash) @@ -359,13 +359,13 @@ func (c *BlobDiskController) ensureDefaultContainer(storageAccountName string) e var err error var blobSvc azstorage.BlobStorageClient - // short circut the check via local cache + // short circuit the check via local cache // we are forgiving the fact that account may not be in cache yet if v, ok := c.accounts[storageAccountName]; ok && v.defaultContainerCreated { return nil } - // not cached, check existance and readiness + // not cached, check existence and readiness bExist, provisionState, _ := c.getStorageAccountState(storageAccountName) // account does not exist @@ -392,7 +392,7 @@ func (c *BlobDiskController) ensureDefaultContainer(storageAccountName string) e c.accounts[storageAccountName].isValidating = 0 }() - // short circut the check again. + // short circuit the check again. if v, ok := c.accounts[storageAccountName]; ok && v.defaultContainerCreated { return nil } @@ -559,9 +559,9 @@ func (c *BlobDiskController) findSANameForDisk(storageAccountType storage.SkuNam continue } - // note: we compute avge stratified by type. - // this to enable user to grow per SA type to avoid low - //avg utilization on one account type skewing all data. + // note: we compute avg stratified by type. + // this is to enable user to grow per SA type to avoid low + // avg utilization on one account type skewing all data. if v.saType == storageAccountType { // compute average @@ -574,7 +574,7 @@ func (c *BlobDiskController) findSANameForDisk(storageAccountType storage.SkuNam // empty account if dCount == 0 { glog.V(2).Infof("azureDisk - account %s identified for a new disk is because it has 0 allocated disks", v.name) - return v.name, nil // shortcircut, avg is good and no need to adjust + return v.name, nil // short circuit, avg is good and no need to adjust } // if this account is less allocated if dCount < maxDiskCount { @@ -600,7 +600,7 @@ func (c *BlobDiskController) findSANameForDisk(storageAccountType storage.SkuNam avgUtilization := float64(disksAfter) / float64(countAccounts*maxDisksPerStorageAccounts) aboveAvg := (avgUtilization > storageAccountUtilizationBeforeGrowing) - // avg are not create and we should craete more accounts if we can + // avg are not create and we should create more accounts if we can if aboveAvg && countAccounts < maxStorageAccounts { glog.V(2).Infof("azureDisk - shared storageAccounts utilzation(%v) > grow-at-avg-utilization (%v). New storage account will be created", avgUtilization, storageAccountUtilizationBeforeGrowing) SAName = getAccountNameForNum(c.getNextAccountNum())