{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/154299823","pull_request_review_id":80441561,"id":154299823,"diff_hunk":"@@ -19,21 +19,44 @@ package azure\n import (\n \t\"fmt\"\n \n+\t\"github.com/Azure/azure-sdk-for-go/arm/storage\"\n+\t\"github.com/Azure/go-autorest/autorest/to\"\n \t\"github.com/golang/glog\"\n )\n \n+const defaultStorageAccountType = string(storage.StandardLRS)\n+\n // CreateFileShare creates a file share, using a matching storage account\n func (az *Cloud) CreateFileShare(name, storageAccount, storageType, location string, requestGB int) (string, string, error) {\n \tvar err error\n \taccounts := []accountWithLocation{}\n \tif len(storageAccount) > 0 {\n \t\taccounts = append(accounts, accountWithLocation{Name: storageAccount})\n \t} else {\n-\t\t// find a storage account\n-\t\taccounts, err = az.getStorageAccounts()\n-\t\tif err != nil {\n-\t\t\t// TODO: create a storage account and container\n-\t\t\treturn \"\", \"\", err\n+\t\t// find a storage account that matches storageType\n+\t\taccounts, err = az.getStorageAccounts(storageType)\n+\t\tif err != nil || len(accounts) == 0 {\n+\t\t\tstorageAccount = getAccountNameForNum(az.getNextAccountNum())","path":"pkg/cloudprovider/providers/azure/azure_storage.go","position":null,"original_position":26,"commit_id":"896e246ef8f281748796ab33e15697126bcaebd0","original_commit_id":"c6ee7e2b96feba6191dff5325b63cce415972114","user":{"login":"andyzhangx","id":4178417,"avatar_url":"https://avatars1.githubusercontent.com/u/4178417?v=4","gravatar_id":"","url":"https://api.github.com/users/andyzhangx","html_url":"https://github.com/andyzhangx","followers_url":"https://api.github.com/users/andyzhangx/followers","following_url":"https://api.github.com/users/andyzhangx/following{/other_user}","gists_url":"https://api.github.com/users/andyzhangx/gists{/gist_id}","starred_url":"https://api.github.com/users/andyzhangx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andyzhangx/subscriptions","organizations_url":"https://api.github.com/users/andyzhangx/orgs","repos_url":"https://api.github.com/users/andyzhangx/repos","events_url":"https://api.github.com/users/andyzhangx/events{/privacy}","received_events_url":"https://api.github.com/users/andyzhangx/received_events","type":"User","site_admin":false},"body":"I will fix this buggy func `getNextAccountNum()` in another PR, will change the account name generation method, use new one `getStorageAccountName` by uuid in this PR","created_at":"2017-12-01T09:24:09Z","updated_at":"2017-12-01T09:24:09Z","html_url":"https://github.com/kubernetes/kubernetes/pull/56557#discussion_r154299823","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/56557","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/154299823"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/56557#discussion_r154299823"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/56557"}},"in_reply_to_id":153791677},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/56557","id":155274111,"html_url":"https://github.com/kubernetes/kubernetes/pull/56557","diff_url":"https://github.com/kubernetes/kubernetes/pull/56557.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/56557.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/56557","number":56557,"state":"open","locked":false,"title":"fix the create azure file pvc failure if there is no storage account in current resource group","user":{"login":"andyzhangx","id":4178417,"avatar_url":"https://avatars1.githubusercontent.com/u/4178417?v=4","gravatar_id":"","url":"https://api.github.com/users/andyzhangx","html_url":"https://github.com/andyzhangx","followers_url":"https://api.github.com/users/andyzhangx/followers","following_url":"https://api.github.com/users/andyzhangx/following{/other_user}","gists_url":"https://api.github.com/users/andyzhangx/gists{/gist_id}","starred_url":"https://api.github.com/users/andyzhangx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andyzhangx/subscriptions","organizations_url":"https://api.github.com/users/andyzhangx/orgs","repos_url":"https://api.github.com/users/andyzhangx/repos","events_url":"https://api.github.com/users/andyzhangx/events{/privacy}","received_events_url":"https://api.github.com/users/andyzhangx/received_events","type":"User","site_admin":false},"body":"<!--  Thanks for sending a pull request!  Here are some tips for you:\r\n1. If this is your first time, read our contributor guidelines https://git.k8s.io/community/contributors/devel/pull-requests.md#the-pr-submit-process and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide\r\n2. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/devel/pull-requests.md#best-practices-for-faster-reviews\r\n3. Follow the instructions for writing a release note: https://git.k8s.io/community/contributors/devel/pull-requests.md#write-release-notes-if-needed\r\n4. If the PR is unfinished, see how to mark it: https://github.com/kubernetes/community/blob/master/contributors/devel/pull-requests.md#marking-unfinished-pull-requests\r\n-->\r\n\r\n**What this PR does / why we need it**:\r\nWhen create an azure file PVC, there will be error if there is no storage account in current resource group.\r\nWith this PR, a storage account will be created if there is no storage account in current resource group.\r\n\r\n**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:\r\nFixes #56556\r\n\r\n**Special notes for your reviewer**:\r\n\r\n**Release note**:\r\n<!--  Write your release note:\r\n1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string \"action required\".\r\n2. If no release note is required, just write \"NONE\".\r\n-->\r\n```\r\nfix the create azure file pvc failure if there is no storage account in current resource group\r\n```\r\n/sig azure\r\n/assign @rootfs \r\n","created_at":"2017-11-29T08:15:48Z","updated_at":"2017-12-01T09:24:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"15a015cbd07f980f624a16ca524d177b34bfad18","assignee":{"login":"rootfs","id":7062400,"avatar_url":"https://avatars0.githubusercontent.com/u/7062400?v=4","gravatar_id":"","url":"https://api.github.com/users/rootfs","html_url":"https://github.com/rootfs","followers_url":"https://api.github.com/users/rootfs/followers","following_url":"https://api.github.com/users/rootfs/following{/other_user}","gists_url":"https://api.github.com/users/rootfs/gists{/gist_id}","starred_url":"https://api.github.com/users/rootfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rootfs/subscriptions","organizations_url":"https://api.github.com/users/rootfs/orgs","repos_url":"https://api.github.com/users/rootfs/repos","events_url":"https://api.github.com/users/rootfs/events{/privacy}","received_events_url":"https://api.github.com/users/rootfs/received_events","type":"User","site_admin":false},"assignees":[{"login":"rootfs","id":7062400,"avatar_url":"https://avatars0.githubusercontent.com/u/7062400?v=4","gravatar_id":"","url":"https://api.github.com/users/rootfs","html_url":"https://github.com/rootfs","followers_url":"https://api.github.com/users/rootfs/followers","following_url":"https://api.github.com/users/rootfs/following{/other_user}","gists_url":"https://api.github.com/users/rootfs/gists{/gist_id}","starred_url":"https://api.github.com/users/rootfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rootfs/subscriptions","organizations_url":"https://api.github.com/users/rootfs/orgs","repos_url":"https://api.github.com/users/rootfs/repos","events_url":"https://api.github.com/users/rootfs/events{/privacy}","received_events_url":"https://api.github.com/users/rootfs/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/56557/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/56557/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/56557/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/896e246ef8f281748796ab33e15697126bcaebd0","head":{"label":"andyzhangx:azurefile-createaccount","ref":"azurefile-createaccount","sha":"896e246ef8f281748796ab33e15697126bcaebd0","user":{"login":"andyzhangx","id":4178417,"avatar_url":"https://avatars1.githubusercontent.com/u/4178417?v=4","gravatar_id":"","url":"https://api.github.com/users/andyzhangx","html_url":"https://github.com/andyzhangx","followers_url":"https://api.github.com/users/andyzhangx/followers","following_url":"https://api.github.com/users/andyzhangx/following{/other_user}","gists_url":"https://api.github.com/users/andyzhangx/gists{/gist_id}","starred_url":"https://api.github.com/users/andyzhangx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andyzhangx/subscriptions","organizations_url":"https://api.github.com/users/andyzhangx/orgs","repos_url":"https://api.github.com/users/andyzhangx/repos","events_url":"https://api.github.com/users/andyzhangx/events{/privacy}","received_events_url":"https://api.github.com/users/andyzhangx/received_events","type":"User","site_admin":false},"repo":{"id":85799482,"name":"kubernetes","full_name":"andyzhangx/kubernetes","owner":{"login":"andyzhangx","id":4178417,"avatar_url":"https://avatars1.githubusercontent.com/u/4178417?v=4","gravatar_id":"","url":"https://api.github.com/users/andyzhangx","html_url":"https://github.com/andyzhangx","followers_url":"https://api.github.com/users/andyzhangx/followers","following_url":"https://api.github.com/users/andyzhangx/following{/other_user}","gists_url":"https://api.github.com/users/andyzhangx/gists{/gist_id}","starred_url":"https://api.github.com/users/andyzhangx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andyzhangx/subscriptions","organizations_url":"https://api.github.com/users/andyzhangx/orgs","repos_url":"https://api.github.com/users/andyzhangx/repos","events_url":"https://api.github.com/users/andyzhangx/events{/privacy}","received_events_url":"https://api.github.com/users/andyzhangx/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andyzhangx/kubernetes","description":"Production-Grade Container Scheduling and Management","fork":true,"url":"https://api.github.com/repos/andyzhangx/kubernetes","forks_url":"https://api.github.com/repos/andyzhangx/kubernetes/forks","keys_url":"https://api.github.com/repos/andyzhangx/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andyzhangx/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andyzhangx/kubernetes/teams","hooks_url":"https://api.github.com/repos/andyzhangx/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/andyzhangx/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/andyzhangx/kubernetes/events","assignees_url":"https://api.github.com/repos/andyzhangx/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/andyzhangx/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/andyzhangx/kubernetes/tags","blobs_url":"https://api.github.com/repos/andyzhangx/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andyzhangx/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andyzhangx/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/andyzhangx/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andyzhangx/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/andyzhangx/kubernetes/languages","stargazers_url":"https://api.github.com/repos/andyzhangx/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/andyzhangx/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/andyzhangx/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/andyzhangx/kubernetes/subscription","commits_url":"https://api.github.com/repos/andyzhangx/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/andyzhangx/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/andyzhangx/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/andyzhangx/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/andyzhangx/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/andyzhangx/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andyzhangx/kubernetes/merges","archive_url":"https://api.github.com/repos/andyzhangx/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andyzhangx/kubernetes/downloads","issues_url":"https://api.github.com/repos/andyzhangx/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/andyzhangx/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/andyzhangx/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/andyzhangx/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andyzhangx/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/andyzhangx/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/andyzhangx/kubernetes/deployments","created_at":"2017-03-22T07:45:13Z","updated_at":"2017-09-25T13:10:07Z","pushed_at":"2017-12-01T07:46:30Z","git_url":"git://github.com/andyzhangx/kubernetes.git","ssh_url":"git@github.com:andyzhangx/kubernetes.git","clone_url":"https://github.com/andyzhangx/kubernetes.git","svn_url":"https://github.com/andyzhangx/kubernetes","homepage":"http://kubernetes.io","size":531563,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"072c98ceb483858a1681b5c6a1fa9825575a7c1c","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"kubernetes/kubernetes","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes/kubernetes","description":"Production-Grade Container Scheduling and Management","fork":false,"url":"https://api.github.com/repos/kubernetes/kubernetes","forks_url":"https://api.github.com/repos/kubernetes/kubernetes/forks","keys_url":"https://api.github.com/repos/kubernetes/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/kubernetes/teams","hooks_url":"https://api.github.com/repos/kubernetes/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/kubernetes/events","assignees_url":"https://api.github.com/repos/kubernetes/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/kubernetes/tags","blobs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/kubernetes/languages","stargazers_url":"https://api.github.com/repos/kubernetes/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/kubernetes/subscription","commits_url":"https://api.github.com/repos/kubernetes/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/kubernetes/merges","archive_url":"https://api.github.com/repos/kubernetes/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/kubernetes/downloads","issues_url":"https://api.github.com/repos/kubernetes/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/kubernetes/deployments","created_at":"2014-06-06T22:56:04Z","updated_at":"2017-12-01T09:21:46Z","pushed_at":"2017-12-01T09:08:15Z","git_url":"git://github.com/kubernetes/kubernetes.git","ssh_url":"git@github.com:kubernetes/kubernetes.git","clone_url":"https://github.com/kubernetes/kubernetes.git","svn_url":"https://github.com/kubernetes/kubernetes","homepage":"http://kubernetes.io","size":748932,"stargazers_count":29499,"watchers_count":29499,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10560,"mirror_url":null,"archived":false,"open_issues_count":5646,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":10560,"open_issues":5646,"watchers":29499,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/56557"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/56557"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/56557"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/56557/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/56557/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/56557/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/896e246ef8f281748796ab33e15697126bcaebd0"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"andyzhangx"}}