From 08f40eac6d008a3967e5dd5be5acd913ec5ffe64 Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Wed, 29 Nov 2017 05:51:32 +0000 Subject: [PATCH] return error when create azure share failed remember error info in CreateFileShare fix typo --- pkg/cloudprovider/providers/azure/azure_storage.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/cloudprovider/providers/azure/azure_storage.go b/pkg/cloudprovider/providers/azure/azure_storage.go index 81388bc428a..641fb8fd6ad 100644 --- a/pkg/cloudprovider/providers/azure/azure_storage.go +++ b/pkg/cloudprovider/providers/azure/azure_storage.go @@ -42,20 +42,24 @@ func (az *Cloud) CreateFileShare(name, storageAccount, storageType, location str // find the access key with this account key, err := az.getStorageAccesskey(account.Name) if err != nil { - glog.V(2).Infof("no key found for storage account %s", account.Name) + err = fmt.Errorf("could not get storage key for storage account %s: %v", account.Name, err) continue } err = az.createFileShare(account.Name, key, name, requestGB) if err != nil { - glog.V(2).Infof("failed to create share %s in account %s: %v", name, account.Name, err) + err = fmt.Errorf("failed to create share %s in account %s: %v", name, account.Name, err) continue } glog.V(4).Infof("created share %s in account %s", name, account.Name) return account.Name, key, err } } - return "", "", fmt.Errorf("failed to find a matching storage account") + + if err == nil { + err = fmt.Errorf("failed to find a matching storage account") + } + return "", "", err } // DeleteFileShare deletes a file share using storage account name and key