{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/pulls/comments/175926212","pull_request_review_id":105538184,"id":175926212,"diff_hunk":"@@ -0,0 +1,51 @@\n+/*\n+Copyright 2018 The Kubernetes Authors.\n+\n+Licensed under the Apache License, Version 2.0 (the \"License\");\n+you may not use this file except in compliance with the License.\n+You may obtain a copy of the License at\n+\n+    http://www.apache.org/licenses/LICENSE-2.0\n+\n+Unless required by applicable law or agreed to in writing, software\n+distributed under the License is distributed on an \"AS IS\" BASIS,\n+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+See the License for the specific language governing permissions and\n+limitations under the License.\n+*/\n+\n+package storage\n+\n+import (\n+\t\"fmt\"\n+\t\"io/ioutil\"\n+)\n+\n+// Source implements FeatureSource.\n+type Source struct{}\n+\n+// Name returns an identifier string for this feature source.\n+func (s Source) Name() string { return \"storage\" }\n+\n+// Discover returns feature names for storage: nonrotational if any SSD drive present.\n+func (s Source) Discover() ([]string, error) {\n+\tfeatures := []string{}\n+\n+\t// Check is there zero in any device rotational status\n+\tblockdevices, err := ioutil.ReadDir(\"/sys/block/\")\n+\tif err == nil {\n+\t\tfor _, bdev := range blockdevices {\n+\t\t\tfname := \"/sys/block/\" + bdev.Name() + \"/queue/rotational\"\n+\t\t\tbytes, err := ioutil.ReadFile(fname)\n+\t\t\tif err != nil {\n+\t\t\t\treturn nil, fmt.Errorf(\"can't read rotational status: %s\", err.Error())\n+\t\t\t}\n+\t\t\tif bytes[0] == byte('0') {\n+\t\t\t\t// Non-rotational storage is present, add label.\n+\t\t\t\tfeatures = append(features, \"nonrotational\")\n+\t\t\t\tbreak // don't repeat add of same label","path":"source/storage/storage.go","position":46,"original_position":46,"commit_id":"ae3acd0fbe25e16cf2ce1d2c3c0f574cbcce46d3","original_commit_id":"ae3acd0fbe25e16cf2ce1d2c3c0f574cbcce46d3","user":{"login":"balajismaniam","id":4707353,"avatar_url":"https://avatars3.githubusercontent.com/u/4707353?v=4","gravatar_id":"","url":"https://api.github.com/users/balajismaniam","html_url":"https://github.com/balajismaniam","followers_url":"https://api.github.com/users/balajismaniam/followers","following_url":"https://api.github.com/users/balajismaniam/following{/other_user}","gists_url":"https://api.github.com/users/balajismaniam/gists{/gist_id}","starred_url":"https://api.github.com/users/balajismaniam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/balajismaniam/subscriptions","organizations_url":"https://api.github.com/users/balajismaniam/orgs","repos_url":"https://api.github.com/users/balajismaniam/repos","events_url":"https://api.github.com/users/balajismaniam/events{/privacy}","received_events_url":"https://api.github.com/users/balajismaniam/received_events","type":"User","site_admin":false},"body":"Nit: You can remove the comment or change it to `avoid adding the same labels`.","created_at":"2018-03-20T21:19:45Z","updated_at":"2018-03-20T21:20:16Z","html_url":"https://github.com/kubernetes-incubator/node-feature-discovery/pull/95#discussion_r175926212","pull_request_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/pulls/95","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/pulls/comments/175926212"},"html":{"href":"https://github.com/kubernetes-incubator/node-feature-discovery/pull/95#discussion_r175926212"},"pull_request":{"href":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/pulls/95"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/pulls/95","id":169952202,"html_url":"https://github.com/kubernetes-incubator/node-feature-discovery/pull/95","diff_url":"https://github.com/kubernetes-incubator/node-feature-discovery/pull/95.diff","patch_url":"https://github.com/kubernetes-incubator/node-feature-discovery/pull/95.patch","issue_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/issues/95","number":95,"state":"open","locked":false,"title":"Added nonrotational storage detection","user":{"login":"okartau","id":1035627,"avatar_url":"https://avatars3.githubusercontent.com/u/1035627?v=4","gravatar_id":"","url":"https://api.github.com/users/okartau","html_url":"https://github.com/okartau","followers_url":"https://api.github.com/users/okartau/followers","following_url":"https://api.github.com/users/okartau/following{/other_user}","gists_url":"https://api.github.com/users/okartau/gists{/gist_id}","starred_url":"https://api.github.com/users/okartau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/okartau/subscriptions","organizations_url":"https://api.github.com/users/okartau/orgs","repos_url":"https://api.github.com/users/okartau/repos","events_url":"https://api.github.com/users/okartau/events{/privacy}","received_events_url":"https://api.github.com/users/okartau/received_events","type":"User","site_admin":false},"body":"Add label if any non-rotational block device is present in the node.\r\nThe label will be: nfd-storage-nonrotational=true\r\nThis change also adds feature source \"storage\".\r\n\r\nFixes #85 \r\n\r\nNote that during label creation it is not known how devices are actually\r\nused by pods, so the approach is simplistic, and more sophisticated\r\nlogic will be needed at some level to make precise decisions.\r\nBut labeling \"if any SSD present\" should cover simple cases reasonably.","created_at":"2018-02-19T12:48:14Z","updated_at":"2018-03-20T21:20:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c842a08c01a242abdf0037785737aff3dba19055","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":459636937,"url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/labels/cncf-cla:%20yes","name":"cncf-cla: yes","color":"bfe5bf","default":false},{"id":684971144,"url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/labels/size/M","name":"size/M","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/pulls/95/commits","review_comments_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/pulls/95/comments","review_comment_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/issues/95/comments","statuses_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/statuses/ae3acd0fbe25e16cf2ce1d2c3c0f574cbcce46d3","head":{"label":"okartau:add-disk-nonrotational","ref":"add-disk-nonrotational","sha":"ae3acd0fbe25e16cf2ce1d2c3c0f574cbcce46d3","user":{"login":"okartau","id":1035627,"avatar_url":"https://avatars3.githubusercontent.com/u/1035627?v=4","gravatar_id":"","url":"https://api.github.com/users/okartau","html_url":"https://github.com/okartau","followers_url":"https://api.github.com/users/okartau/followers","following_url":"https://api.github.com/users/okartau/following{/other_user}","gists_url":"https://api.github.com/users/okartau/gists{/gist_id}","starred_url":"https://api.github.com/users/okartau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/okartau/subscriptions","organizations_url":"https://api.github.com/users/okartau/orgs","repos_url":"https://api.github.com/users/okartau/repos","events_url":"https://api.github.com/users/okartau/events{/privacy}","received_events_url":"https://api.github.com/users/okartau/received_events","type":"User","site_admin":false},"repo":{"id":119659134,"name":"node-feature-discovery","full_name":"okartau/node-feature-discovery","owner":{"login":"okartau","id":1035627,"avatar_url":"https://avatars3.githubusercontent.com/u/1035627?v=4","gravatar_id":"","url":"https://api.github.com/users/okartau","html_url":"https://github.com/okartau","followers_url":"https://api.github.com/users/okartau/followers","following_url":"https://api.github.com/users/okartau/following{/other_user}","gists_url":"https://api.github.com/users/okartau/gists{/gist_id}","starred_url":"https://api.github.com/users/okartau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/okartau/subscriptions","organizations_url":"https://api.github.com/users/okartau/orgs","repos_url":"https://api.github.com/users/okartau/repos","events_url":"https://api.github.com/users/okartau/events{/privacy}","received_events_url":"https://api.github.com/users/okartau/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/okartau/node-feature-discovery","description":"Node feature discovery for Kubernetes","fork":true,"url":"https://api.github.com/repos/okartau/node-feature-discovery","forks_url":"https://api.github.com/repos/okartau/node-feature-discovery/forks","keys_url":"https://api.github.com/repos/okartau/node-feature-discovery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/okartau/node-feature-discovery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/okartau/node-feature-discovery/teams","hooks_url":"https://api.github.com/repos/okartau/node-feature-discovery/hooks","issue_events_url":"https://api.github.com/repos/okartau/node-feature-discovery/issues/events{/number}","events_url":"https://api.github.com/repos/okartau/node-feature-discovery/events","assignees_url":"https://api.github.com/repos/okartau/node-feature-discovery/assignees{/user}","branches_url":"https://api.github.com/repos/okartau/node-feature-discovery/branches{/branch}","tags_url":"https://api.github.com/repos/okartau/node-feature-discovery/tags","blobs_url":"https://api.github.com/repos/okartau/node-feature-discovery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/okartau/node-feature-discovery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/okartau/node-feature-discovery/git/refs{/sha}","trees_url":"https://api.github.com/repos/okartau/node-feature-discovery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/okartau/node-feature-discovery/statuses/{sha}","languages_url":"https://api.github.com/repos/okartau/node-feature-discovery/languages","stargazers_url":"https://api.github.com/repos/okartau/node-feature-discovery/stargazers","contributors_url":"https://api.github.com/repos/okartau/node-feature-discovery/contributors","subscribers_url":"https://api.github.com/repos/okartau/node-feature-discovery/subscribers","subscription_url":"https://api.github.com/repos/okartau/node-feature-discovery/subscription","commits_url":"https://api.github.com/repos/okartau/node-feature-discovery/commits{/sha}","git_commits_url":"https://api.github.com/repos/okartau/node-feature-discovery/git/commits{/sha}","comments_url":"https://api.github.com/repos/okartau/node-feature-discovery/comments{/number}","issue_comment_url":"https://api.github.com/repos/okartau/node-feature-discovery/issues/comments{/number}","contents_url":"https://api.github.com/repos/okartau/node-feature-discovery/contents/{+path}","compare_url":"https://api.github.com/repos/okartau/node-feature-discovery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/okartau/node-feature-discovery/merges","archive_url":"https://api.github.com/repos/okartau/node-feature-discovery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/okartau/node-feature-discovery/downloads","issues_url":"https://api.github.com/repos/okartau/node-feature-discovery/issues{/number}","pulls_url":"https://api.github.com/repos/okartau/node-feature-discovery/pulls{/number}","milestones_url":"https://api.github.com/repos/okartau/node-feature-discovery/milestones{/number}","notifications_url":"https://api.github.com/repos/okartau/node-feature-discovery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/okartau/node-feature-discovery/labels{/name}","releases_url":"https://api.github.com/repos/okartau/node-feature-discovery/releases{/id}","deployments_url":"https://api.github.com/repos/okartau/node-feature-discovery/deployments","created_at":"2018-01-31T08:41:14Z","updated_at":"2018-01-31T08:41:16Z","pushed_at":"2018-03-19T06:43:59Z","git_url":"git://github.com/okartau/node-feature-discovery.git","ssh_url":"git@github.com:okartau/node-feature-discovery.git","clone_url":"https://github.com/okartau/node-feature-discovery.git","svn_url":"https://github.com/okartau/node-feature-discovery","homepage":"","size":74407,"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,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes-incubator:master","ref":"master","sha":"348f3a7f897edc8b899ebd11b266a4a20b5dc3ca","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":63999998,"name":"node-feature-discovery","full_name":"kubernetes-incubator/node-feature-discovery","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/node-feature-discovery","description":"Node feature discovery for Kubernetes","fork":false,"url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery","forks_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/forks","keys_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/teams","hooks_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/hooks","issue_events_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/events","assignees_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/tags","blobs_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/languages","stargazers_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/stargazers","contributors_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/contributors","subscribers_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/subscribers","subscription_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/subscription","commits_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/merges","archive_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/downloads","issues_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/deployments","created_at":"2016-07-23T05:07:52Z","updated_at":"2018-03-16T17:06:36Z","pushed_at":"2018-03-20T15:01:15Z","git_url":"git://github.com/kubernetes-incubator/node-feature-discovery.git","ssh_url":"git@github.com:kubernetes-incubator/node-feature-discovery.git","clone_url":"https://github.com/kubernetes-incubator/node-feature-discovery.git","svn_url":"https://github.com/kubernetes-incubator/node-feature-discovery","homepage":"","size":74399,"stargazers_count":65,"watchers_count":65,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":26,"mirror_url":null,"archived":false,"open_issues_count":28,"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":26,"open_issues":28,"watchers":65,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/pulls/95"},"html":{"href":"https://github.com/kubernetes-incubator/node-feature-discovery/pull/95"},"issue":{"href":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/issues/95"},"comments":{"href":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/issues/95/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/pulls/95/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/pulls/95/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes-incubator/node-feature-discovery/statuses/ae3acd0fbe25e16cf2ce1d2c3c0f574cbcce46d3"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"balajismaniam"}}