{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes-incubator/external-storage/pulls/comments/145287075","pull_request_review_id":70064458,"id":145287075,"diff_hunk":"@@ -179,25 +179,24 @@ func (d *Discoverer) createPV(file, class string, config common.MountConfig, cap\n \tglog.Infof(\"Created PV %q for volume at %q\", pvName, outsidePath)\n }\n \n-// roundDown the capacity so that it is easier to read\n+// roundDown the capacity to an easy to read value\n func roundDownCapacityPretty(capacity int64) int64 {\n-\t// capacity is exactly divisible by Gi\n-\tif capacity%1024*1024*1024 == 0 {\n-\t\treturn capacity\n-\t}\n-\tsizeGi := util.RoundUpSize(capacity, 1024*1024*1024)\n-\tif (sizeGi - 1) >= 10 {\n-\t\t// rounddown to nearest Gi\n-\t\treturn (sizeGi - 1) * 1024 * 1024 * 1024\n-\t}\n-\t// capacity is exactly divisible by Mi\n-\tif capacity%1024*1024 == 0 {\n-\t\treturn capacity\n-\t}\n-\tsizeMi := util.RoundUpSize(capacity, 1024*1024)\n-\tif (sizeMi - 1) >= 10 {\n-\t\t// rounddown to nearest Mi\n-\t\treturn (sizeMi - 1) * 1024 * 1024\n+\n+\tconst (\n+\t\tKiB int64 = 1024\n+\t\tMiB int64 = 1024 * KiB\n+\t\tGiB int64 = 1024 * MiB\n+\t\tTiB int64 = 1024 * GiB\n+\t)\n+\teasyToReadSizes := []int64{TiB, GiB, MiB}\n+\n+\t// rounddown to the nearest easy to read size\n+\t// such that there are at least 10 units at that size\n+\tfor _, easyToReadSize := range easyToReadSizes {\n+\t\tsize := util.RoundDownSize(capacity, easyToReadSize)\n+\t\tif size >= 10 {","path":"local-volume/provisioner/pkg/discovery/discovery.go","position":37,"original_position":37,"commit_id":"364d20fc448ae8e4bd27639c789edd559ce9279e","original_commit_id":"364d20fc448ae8e4bd27639c789edd559ce9279e","user":{"login":"msau42","id":24448061,"avatar_url":"https://avatars3.githubusercontent.com/u/24448061?v=4","gravatar_id":"","url":"https://api.github.com/users/msau42","html_url":"https://github.com/msau42","followers_url":"https://api.github.com/users/msau42/followers","following_url":"https://api.github.com/users/msau42/following{/other_user}","gists_url":"https://api.github.com/users/msau42/gists{/gist_id}","starred_url":"https://api.github.com/users/msau42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msau42/subscriptions","organizations_url":"https://api.github.com/users/msau42/orgs","repos_url":"https://api.github.com/users/msau42/repos","events_url":"https://api.github.com/users/msau42/events{/privacy}","received_events_url":"https://api.github.com/users/msau42/received_events","type":"User","site_admin":false},"body":"Can you add a test case that shows you had to go down to the next unit in order to keep the precision?","created_at":"2017-10-17T23:54:42Z","updated_at":"2017-10-17T23:54:48Z","html_url":"https://github.com/kubernetes-incubator/external-storage/pull/412#discussion_r145287075","pull_request_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/pulls/412","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/kubernetes-incubator/external-storage/pulls/comments/145287075"},"html":{"href":"https://github.com/kubernetes-incubator/external-storage/pull/412#discussion_r145287075"},"pull_request":{"href":"https://api.github.com/repos/kubernetes-incubator/external-storage/pulls/412"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes-incubator/external-storage/pulls/412","id":146602356,"html_url":"https://github.com/kubernetes-incubator/external-storage/pull/412","diff_url":"https://github.com/kubernetes-incubator/external-storage/pull/412.diff","patch_url":"https://github.com/kubernetes-incubator/external-storage/pull/412.patch","issue_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/issues/412","number":412,"state":"open","locked":false,"title":"[local-volume] Set local-volume PV capacity to an easily readable value.","user":{"login":"ianchakeres","id":4367440,"avatar_url":"https://avatars0.githubusercontent.com/u/4367440?v=4","gravatar_id":"","url":"https://api.github.com/users/ianchakeres","html_url":"https://github.com/ianchakeres","followers_url":"https://api.github.com/users/ianchakeres/followers","following_url":"https://api.github.com/users/ianchakeres/following{/other_user}","gists_url":"https://api.github.com/users/ianchakeres/gists{/gist_id}","starred_url":"https://api.github.com/users/ianchakeres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianchakeres/subscriptions","organizations_url":"https://api.github.com/users/ianchakeres/orgs","repos_url":"https://api.github.com/users/ianchakeres/repos","events_url":"https://api.github.com/users/ianchakeres/events{/privacy}","received_events_url":"https://api.github.com/users/ianchakeres/received_events","type":"User","site_admin":false},"body":"For volumes larger than 10Ti, it will round down to the nearest 10Gi.\r\nFor volumes larger than 10Gi, it will round down to the nearest 1Gi.\r\nFor volumes larger than 10Mi, it will round down to the nearest 1Mi.\r\nFor volumes smaller than 10Mi, it will provide actual capacity (displayed in Ki).\r\n\r\nThis PR closes https://github.com/kubernetes-incubator/external-storage/issues/405\r\n\r\n","created_at":"2017-10-14T13:15:45Z","updated_at":"2017-10-17T23:54:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b7f4d27095b380dbabd9c9cd81fd3ead9fdb8b94","assignee":{"login":"msau42","id":24448061,"avatar_url":"https://avatars3.githubusercontent.com/u/24448061?v=4","gravatar_id":"","url":"https://api.github.com/users/msau42","html_url":"https://github.com/msau42","followers_url":"https://api.github.com/users/msau42/followers","following_url":"https://api.github.com/users/msau42/following{/other_user}","gists_url":"https://api.github.com/users/msau42/gists{/gist_id}","starred_url":"https://api.github.com/users/msau42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msau42/subscriptions","organizations_url":"https://api.github.com/users/msau42/orgs","repos_url":"https://api.github.com/users/msau42/repos","events_url":"https://api.github.com/users/msau42/events{/privacy}","received_events_url":"https://api.github.com/users/msau42/received_events","type":"User","site_admin":false},"assignees":[{"login":"msau42","id":24448061,"avatar_url":"https://avatars3.githubusercontent.com/u/24448061?v=4","gravatar_id":"","url":"https://api.github.com/users/msau42","html_url":"https://github.com/msau42","followers_url":"https://api.github.com/users/msau42/followers","following_url":"https://api.github.com/users/msau42/following{/other_user}","gists_url":"https://api.github.com/users/msau42/gists{/gist_id}","starred_url":"https://api.github.com/users/msau42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msau42/subscriptions","organizations_url":"https://api.github.com/users/msau42/orgs","repos_url":"https://api.github.com/users/msau42/repos","events_url":"https://api.github.com/users/msau42/events{/privacy}","received_events_url":"https://api.github.com/users/msau42/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/pulls/412/commits","review_comments_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/pulls/412/comments","review_comment_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/issues/412/comments","statuses_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/statuses/364d20fc448ae8e4bd27639c789edd559ce9279e","head":{"label":"ianchakeres:lv-rounded-capacity","ref":"lv-rounded-capacity","sha":"364d20fc448ae8e4bd27639c789edd559ce9279e","user":{"login":"ianchakeres","id":4367440,"avatar_url":"https://avatars0.githubusercontent.com/u/4367440?v=4","gravatar_id":"","url":"https://api.github.com/users/ianchakeres","html_url":"https://github.com/ianchakeres","followers_url":"https://api.github.com/users/ianchakeres/followers","following_url":"https://api.github.com/users/ianchakeres/following{/other_user}","gists_url":"https://api.github.com/users/ianchakeres/gists{/gist_id}","starred_url":"https://api.github.com/users/ianchakeres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianchakeres/subscriptions","organizations_url":"https://api.github.com/users/ianchakeres/orgs","repos_url":"https://api.github.com/users/ianchakeres/repos","events_url":"https://api.github.com/users/ianchakeres/events{/privacy}","received_events_url":"https://api.github.com/users/ianchakeres/received_events","type":"User","site_admin":false},"repo":{"id":95071775,"name":"external-storage","full_name":"ianchakeres/external-storage","owner":{"login":"ianchakeres","id":4367440,"avatar_url":"https://avatars0.githubusercontent.com/u/4367440?v=4","gravatar_id":"","url":"https://api.github.com/users/ianchakeres","html_url":"https://github.com/ianchakeres","followers_url":"https://api.github.com/users/ianchakeres/followers","following_url":"https://api.github.com/users/ianchakeres/following{/other_user}","gists_url":"https://api.github.com/users/ianchakeres/gists{/gist_id}","starred_url":"https://api.github.com/users/ianchakeres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianchakeres/subscriptions","organizations_url":"https://api.github.com/users/ianchakeres/orgs","repos_url":"https://api.github.com/users/ianchakeres/repos","events_url":"https://api.github.com/users/ianchakeres/events{/privacy}","received_events_url":"https://api.github.com/users/ianchakeres/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ianchakeres/external-storage","description":"External Storage Plugins, Provisoners, and Helper Libraries","fork":true,"url":"https://api.github.com/repos/ianchakeres/external-storage","forks_url":"https://api.github.com/repos/ianchakeres/external-storage/forks","keys_url":"https://api.github.com/repos/ianchakeres/external-storage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ianchakeres/external-storage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ianchakeres/external-storage/teams","hooks_url":"https://api.github.com/repos/ianchakeres/external-storage/hooks","issue_events_url":"https://api.github.com/repos/ianchakeres/external-storage/issues/events{/number}","events_url":"https://api.github.com/repos/ianchakeres/external-storage/events","assignees_url":"https://api.github.com/repos/ianchakeres/external-storage/assignees{/user}","branches_url":"https://api.github.com/repos/ianchakeres/external-storage/branches{/branch}","tags_url":"https://api.github.com/repos/ianchakeres/external-storage/tags","blobs_url":"https://api.github.com/repos/ianchakeres/external-storage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ianchakeres/external-storage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ianchakeres/external-storage/git/refs{/sha}","trees_url":"https://api.github.com/repos/ianchakeres/external-storage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ianchakeres/external-storage/statuses/{sha}","languages_url":"https://api.github.com/repos/ianchakeres/external-storage/languages","stargazers_url":"https://api.github.com/repos/ianchakeres/external-storage/stargazers","contributors_url":"https://api.github.com/repos/ianchakeres/external-storage/contributors","subscribers_url":"https://api.github.com/repos/ianchakeres/external-storage/subscribers","subscription_url":"https://api.github.com/repos/ianchakeres/external-storage/subscription","commits_url":"https://api.github.com/repos/ianchakeres/external-storage/commits{/sha}","git_commits_url":"https://api.github.com/repos/ianchakeres/external-storage/git/commits{/sha}","comments_url":"https://api.github.com/repos/ianchakeres/external-storage/comments{/number}","issue_comment_url":"https://api.github.com/repos/ianchakeres/external-storage/issues/comments{/number}","contents_url":"https://api.github.com/repos/ianchakeres/external-storage/contents/{+path}","compare_url":"https://api.github.com/repos/ianchakeres/external-storage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ianchakeres/external-storage/merges","archive_url":"https://api.github.com/repos/ianchakeres/external-storage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ianchakeres/external-storage/downloads","issues_url":"https://api.github.com/repos/ianchakeres/external-storage/issues{/number}","pulls_url":"https://api.github.com/repos/ianchakeres/external-storage/pulls{/number}","milestones_url":"https://api.github.com/repos/ianchakeres/external-storage/milestones{/number}","notifications_url":"https://api.github.com/repos/ianchakeres/external-storage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ianchakeres/external-storage/labels{/name}","releases_url":"https://api.github.com/repos/ianchakeres/external-storage/releases{/id}","deployments_url":"https://api.github.com/repos/ianchakeres/external-storage/deployments","created_at":"2017-06-22T03:43:35Z","updated_at":"2017-06-22T03:43:37Z","pushed_at":"2017-10-17T23:51:23Z","git_url":"git://github.com/ianchakeres/external-storage.git","ssh_url":"git@github.com:ianchakeres/external-storage.git","clone_url":"https://github.com/ianchakeres/external-storage.git","svn_url":"https://github.com/ianchakeres/external-storage","homepage":null,"size":72101,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes-incubator:master","ref":"master","sha":"d4a764204942c7115b4c19f4ef3553bfdea9e672","user":{"login":"kubernetes-incubator","id":20862812,"avatar_url":"https://avatars2.githubusercontent.com/u/20862812?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes-incubator","html_url":"https://github.com/kubernetes-incubator","followers_url":"https://api.github.com/users/kubernetes-incubator/followers","following_url":"https://api.github.com/users/kubernetes-incubator/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes-incubator/subscriptions","organizations_url":"https://api.github.com/users/kubernetes-incubator/orgs","repos_url":"https://api.github.com/users/kubernetes-incubator/repos","events_url":"https://api.github.com/users/kubernetes-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes-incubator/received_events","type":"Organization","site_admin":false},"repo":{"id":82572869,"name":"external-storage","full_name":"kubernetes-incubator/external-storage","owner":{"login":"kubernetes-incubator","id":20862812,"avatar_url":"https://avatars2.githubusercontent.com/u/20862812?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes-incubator","html_url":"https://github.com/kubernetes-incubator","followers_url":"https://api.github.com/users/kubernetes-incubator/followers","following_url":"https://api.github.com/users/kubernetes-incubator/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes-incubator/subscriptions","organizations_url":"https://api.github.com/users/kubernetes-incubator/orgs","repos_url":"https://api.github.com/users/kubernetes-incubator/repos","events_url":"https://api.github.com/users/kubernetes-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes-incubator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes-incubator/external-storage","description":"External storage plugins, provisioners, and helper libraries","fork":false,"url":"https://api.github.com/repos/kubernetes-incubator/external-storage","forks_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/forks","keys_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/teams","hooks_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/hooks","issue_events_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/events","assignees_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/tags","blobs_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/languages","stargazers_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/stargazers","contributors_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/contributors","subscribers_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/subscribers","subscription_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/subscription","commits_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/merges","archive_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/downloads","issues_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes-incubator/external-storage/deployments","created_at":"2017-02-20T15:29:16Z","updated_at":"2017-10-17T18:25:15Z","pushed_at":"2017-10-17T23:51:24Z","git_url":"git://github.com/kubernetes-incubator/external-storage.git","ssh_url":"git@github.com:kubernetes-incubator/external-storage.git","clone_url":"https://github.com/kubernetes-incubator/external-storage.git","svn_url":"https://github.com/kubernetes-incubator/external-storage","homepage":"","size":72100,"stargazers_count":227,"watchers_count":227,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":137,"mirror_url":null,"open_issues_count":54,"forks":137,"open_issues":54,"watchers":227,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes-incubator/external-storage/pulls/412"},"html":{"href":"https://github.com/kubernetes-incubator/external-storage/pull/412"},"issue":{"href":"https://api.github.com/repos/kubernetes-incubator/external-storage/issues/412"},"comments":{"href":"https://api.github.com/repos/kubernetes-incubator/external-storage/issues/412/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes-incubator/external-storage/pulls/412/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes-incubator/external-storage/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes-incubator/external-storage/pulls/412/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes-incubator/external-storage/statuses/364d20fc448ae8e4bd27639c789edd559ce9279e"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"msau42"}}