{"action":"created","comment":{"url":"https://api.github.com/repos/xcat2/xcat-core/pulls/comments/45576746","id":45576746,"diff_hunk":"@@ -0,0 +1,113 @@\n+#!/bin/bash\n+#set -x\n+\n+XCATPORT=3001\n+export XCATPORT\n+\n+#XCATMASTER=\"10.3.5.21\"\n+ADAPTERFILE=\"/tmp/adapterinfo\"\n+SCANNICLOG=\"/tmp/adapterscan.log\"\n+\n+if [ -f \"$SCANNICLOG\" ]; then\n+    rm -f \"$SCANNICLOG\"  2>&1 >/dev/null\n+fi\n+\n+if [ -f \"$ADAPTERFILE\" ]; then\n+    echo \"rm -f $ADAPTERFILE\" > \"$SCANNICLOG\"\n+    rm -f \"$ADAPTERFILE\"  2>&1  >> \"$SCANNICLOG\"\n+fi\n+\n+\n+echo '<xcatrequest>' > \"$ADAPTERFILE\"\n+echo \"<command>findadapter</command>\" >> \"$ADAPTERFILE\"\n+echo \"<ClientType>cli</ClientType>\" >> \"$ADAPTERFILE\"\n+echo \"<hostname>$HOSTNAME</hostname>\" >> \"$ADAPTERFILE\"\n+\n+#scan adapters have recognized by operating system\n+for nic in `ls /sys/class/net/`; do\n+    if [ \"$nic\" == \"lo\" ]; then\n+        continue\n+    else\n+        echo '<nic>' >> \"$ADAPTERFILE\"\n+        tmp=`udevadm info /sys/class/net/\"$nic\" | grep \" INTERFACE\" | awk -F '=' '{print $2}'`\n+        if [ ! -z \"$tmp\" ]; then\n+            echo \"<interface>$tmp</interface>\" >> \"$ADAPTERFILE\"\n+        fi\n+        tmp=`udevadm info /sys/class/net/\"$nic\" | grep ID_NET_NAME | awk -F '=' '{print $2}'|sort -u| tr -s \"\\n\" \",\" | sed \"s/,$//g\"`\n+        if [ ! -z \"$tmp\" ]; then\n+            echo \"<predictablename>$tmp</predictablename>\" >> \"$ADAPTERFILE\"\n+        fi\n+        tmp=`udevadm info /sys/class/net/\"$nic\" | grep DEVPATH | awk -F 'devices' '{print $2}'`\n+        if [ ! -z \"$tmp\" ]; then\t\t\n+            echo \"<pcilocation>${tmp%/net*}</pcilocation>\" >> \"$ADAPTERFILE\"\n+        fi\n+        tmp=`udevadm info /sys/class/net/\"$nic\" | grep ID_NET_NAME_MAC | awk -F '=' '{print $2}'`\n+        if [ ! -z \"$tmp\" ]; then\t\t\n+            echo \"<mac>${tmp##*enx}</mac>\" >> \"$ADAPTERFILE\"\n+        fi\t\t\n+        tmp=`udevadm info /sys/class/net/\"$nic\" | grep ID_VENDOR_FROM_DATABASE | awk -F '=' '{print $2}' | tr -s \"\\n\" \",\" | sed \"s/,$//g\"`\n+        if [ ! -z \"$tmp\" ]; then\t\t\n+            echo \"<vendor>$tmp</vendor>\" >> \"$ADAPTERFILE\"\n+        fi\t\t\n+        tmp=`udevadm info /sys/class/net/\"$nic\" | grep ID_MODEL_FROM_DATABASE | awk -F '=' '{print $2}'`\n+        if [ ! -z \"$tmp\" ]; then\t\t\n+            echo \"<model>$tmp</model>\" >> \"$ADAPTERFILE\"\n+        fi\n+        echo '</nic>' >> \"$ADAPTERFILE\"\n+    fi\n+done\n+\n+for pci in `lspci |grep Ethernet |awk '{print $1}' `; do\n+    if ! cat \"$ADAPTERFILE\" |grep \"$pci\" >/dev/null; then ","path":"xCAT-genesis-scripts/bin/getadapter","position":61,"original_position":61,"commit_id":"939773081c01321152624d200eea10ed9ead804b","original_commit_id":"939773081c01321152624d200eea10ed9ead804b","user":{"login":"neo954","id":12424088,"avatar_url":"https://avatars.githubusercontent.com/u/12424088?v=3","gravatar_id":"","url":"https://api.github.com/users/neo954","html_url":"https://github.com/neo954","followers_url":"https://api.github.com/users/neo954/followers","following_url":"https://api.github.com/users/neo954/following{/other_user}","gists_url":"https://api.github.com/users/neo954/gists{/gist_id}","starred_url":"https://api.github.com/users/neo954/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neo954/subscriptions","organizations_url":"https://api.github.com/users/neo954/orgs","repos_url":"https://api.github.com/users/neo954/repos","events_url":"https://api.github.com/users/neo954/events{/privacy}","received_events_url":"https://api.github.com/users/neo954/received_events","type":"User","site_admin":false},"body":"if ! grep -q \"$pci\" \"$ADAPTERFILE\" 2>/dev/null; then","created_at":"2015-11-23T07:26:31Z","updated_at":"2015-11-23T07:26:31Z","html_url":"https://github.com/xcat2/xcat-core/pull/452#discussion_r45576746","pull_request_url":"https://api.github.com/repos/xcat2/xcat-core/pulls/452","_links":{"self":{"href":"https://api.github.com/repos/xcat2/xcat-core/pulls/comments/45576746"},"html":{"href":"https://github.com/xcat2/xcat-core/pull/452#discussion_r45576746"},"pull_request":{"href":"https://api.github.com/repos/xcat2/xcat-core/pulls/452"}}},"pull_request":{"url":"https://api.github.com/repos/xcat2/xcat-core/pulls/452","id":51460850,"html_url":"https://github.com/xcat2/xcat-core/pull/452","diff_url":"https://github.com/xcat2/xcat-core/pull/452.diff","patch_url":"https://github.com/xcat2/xcat-core/pull/452.patch","issue_url":"https://api.github.com/repos/xcat2/xcat-core/issues/452","number":452,"state":"open","locked":false,"title":"The initial implementation of getadapters","user":{"login":"hu-weihua","id":7370626,"avatar_url":"https://avatars.githubusercontent.com/u/7370626?v=3","gravatar_id":"","url":"https://api.github.com/users/hu-weihua","html_url":"https://github.com/hu-weihua","followers_url":"https://api.github.com/users/hu-weihua/followers","following_url":"https://api.github.com/users/hu-weihua/following{/other_user}","gists_url":"https://api.github.com/users/hu-weihua/gists{/gist_id}","starred_url":"https://api.github.com/users/hu-weihua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hu-weihua/subscriptions","organizations_url":"https://api.github.com/users/hu-weihua/orgs","repos_url":"https://api.github.com/users/hu-weihua/repos","events_url":"https://api.github.com/users/hu-weihua/events{/privacy}","received_events_url":"https://api.github.com/users/hu-weihua/received_events","type":"User","site_admin":false},"body":"The mini design please refer to \r\nhttps://github.com/xcat2/xcat-core/wiki/Predict_long_nicname_for_RH7\r\n\r\nthe doc ``getadapters.rst`` located under ``/docs/source/advanced/networks`` temporarily is just for help to review the code.\r\n\r\n\r\n","created_at":"2015-11-22T09:04:24Z","updated_at":"2015-11-23T07:26:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e58361a1b08eb26c67c3d44773989f4bd38622ef","assignee":null,"milestone":{"url":"https://api.github.com/repos/xcat2/xcat-core/milestones/6","html_url":"https://github.com/xcat2/xcat-core/milestones/2.12","labels_url":"https://api.github.com/repos/xcat2/xcat-core/milestones/6/labels","id":1369794,"number":6,"title":"2.12","description":null,"creator":{"login":"zet809","id":8222144,"avatar_url":"https://avatars.githubusercontent.com/u/8222144?v=3","gravatar_id":"","url":"https://api.github.com/users/zet809","html_url":"https://github.com/zet809","followers_url":"https://api.github.com/users/zet809/followers","following_url":"https://api.github.com/users/zet809/following{/other_user}","gists_url":"https://api.github.com/users/zet809/gists{/gist_id}","starred_url":"https://api.github.com/users/zet809/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zet809/subscriptions","organizations_url":"https://api.github.com/users/zet809/orgs","repos_url":"https://api.github.com/users/zet809/repos","events_url":"https://api.github.com/users/zet809/events{/privacy}","received_events_url":"https://api.github.com/users/zet809/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":1,"state":"open","created_at":"2015-10-22T07:51:37Z","updated_at":"2015-11-23T02:11:26Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/xcat2/xcat-core/pulls/452/commits","review_comments_url":"https://api.github.com/repos/xcat2/xcat-core/pulls/452/comments","review_comment_url":"https://api.github.com/repos/xcat2/xcat-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xcat2/xcat-core/issues/452/comments","statuses_url":"https://api.github.com/repos/xcat2/xcat-core/statuses/939773081c01321152624d200eea10ed9ead804b","head":{"label":"hu-weihua:getadapters","ref":"getadapters","sha":"939773081c01321152624d200eea10ed9ead804b","user":{"login":"hu-weihua","id":7370626,"avatar_url":"https://avatars.githubusercontent.com/u/7370626?v=3","gravatar_id":"","url":"https://api.github.com/users/hu-weihua","html_url":"https://github.com/hu-weihua","followers_url":"https://api.github.com/users/hu-weihua/followers","following_url":"https://api.github.com/users/hu-weihua/following{/other_user}","gists_url":"https://api.github.com/users/hu-weihua/gists{/gist_id}","starred_url":"https://api.github.com/users/hu-weihua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hu-weihua/subscriptions","organizations_url":"https://api.github.com/users/hu-weihua/orgs","repos_url":"https://api.github.com/users/hu-weihua/repos","events_url":"https://api.github.com/users/hu-weihua/events{/privacy}","received_events_url":"https://api.github.com/users/hu-weihua/received_events","type":"User","site_admin":false},"repo":{"id":40430481,"name":"xcat-core","full_name":"hu-weihua/xcat-core","owner":{"login":"hu-weihua","id":7370626,"avatar_url":"https://avatars.githubusercontent.com/u/7370626?v=3","gravatar_id":"","url":"https://api.github.com/users/hu-weihua","html_url":"https://github.com/hu-weihua","followers_url":"https://api.github.com/users/hu-weihua/followers","following_url":"https://api.github.com/users/hu-weihua/following{/other_user}","gists_url":"https://api.github.com/users/hu-weihua/gists{/gist_id}","starred_url":"https://api.github.com/users/hu-weihua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hu-weihua/subscriptions","organizations_url":"https://api.github.com/users/hu-weihua/orgs","repos_url":"https://api.github.com/users/hu-weihua/repos","events_url":"https://api.github.com/users/hu-weihua/events{/privacy}","received_events_url":"https://api.github.com/users/hu-weihua/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hu-weihua/xcat-core","description":"Code repo for xCAT core packages","fork":true,"url":"https://api.github.com/repos/hu-weihua/xcat-core","forks_url":"https://api.github.com/repos/hu-weihua/xcat-core/forks","keys_url":"https://api.github.com/repos/hu-weihua/xcat-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hu-weihua/xcat-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hu-weihua/xcat-core/teams","hooks_url":"https://api.github.com/repos/hu-weihua/xcat-core/hooks","issue_events_url":"https://api.github.com/repos/hu-weihua/xcat-core/issues/events{/number}","events_url":"https://api.github.com/repos/hu-weihua/xcat-core/events","assignees_url":"https://api.github.com/repos/hu-weihua/xcat-core/assignees{/user}","branches_url":"https://api.github.com/repos/hu-weihua/xcat-core/branches{/branch}","tags_url":"https://api.github.com/repos/hu-weihua/xcat-core/tags","blobs_url":"https://api.github.com/repos/hu-weihua/xcat-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hu-weihua/xcat-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hu-weihua/xcat-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/hu-weihua/xcat-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hu-weihua/xcat-core/statuses/{sha}","languages_url":"https://api.github.com/repos/hu-weihua/xcat-core/languages","stargazers_url":"https://api.github.com/repos/hu-weihua/xcat-core/stargazers","contributors_url":"https://api.github.com/repos/hu-weihua/xcat-core/contributors","subscribers_url":"https://api.github.com/repos/hu-weihua/xcat-core/subscribers","subscription_url":"https://api.github.com/repos/hu-weihua/xcat-core/subscription","commits_url":"https://api.github.com/repos/hu-weihua/xcat-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/hu-weihua/xcat-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/hu-weihua/xcat-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/hu-weihua/xcat-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/hu-weihua/xcat-core/contents/{+path}","compare_url":"https://api.github.com/repos/hu-weihua/xcat-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hu-weihua/xcat-core/merges","archive_url":"https://api.github.com/repos/hu-weihua/xcat-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hu-weihua/xcat-core/downloads","issues_url":"https://api.github.com/repos/hu-weihua/xcat-core/issues{/number}","pulls_url":"https://api.github.com/repos/hu-weihua/xcat-core/pulls{/number}","milestones_url":"https://api.github.com/repos/hu-weihua/xcat-core/milestones{/number}","notifications_url":"https://api.github.com/repos/hu-weihua/xcat-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hu-weihua/xcat-core/labels{/name}","releases_url":"https://api.github.com/repos/hu-weihua/xcat-core/releases{/id}","created_at":"2015-08-09T08:43:37Z","updated_at":"2015-08-09T08:43:43Z","pushed_at":"2015-11-23T02:36:09Z","git_url":"git://github.com/hu-weihua/xcat-core.git","ssh_url":"git@github.com:hu-weihua/xcat-core.git","clone_url":"https://github.com/hu-weihua/xcat-core.git","svn_url":"https://github.com/hu-weihua/xcat-core","homepage":null,"size":180977,"stargazers_count":0,"watchers_count":0,"language":"Perl","has_issues":false,"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":"xcat2:master","ref":"master","sha":"895ad1fa02cd4a69a35ffd07256ade3ffc6491aa","user":{"login":"xcat2","id":10124414,"avatar_url":"https://avatars.githubusercontent.com/u/10124414?v=3","gravatar_id":"","url":"https://api.github.com/users/xcat2","html_url":"https://github.com/xcat2","followers_url":"https://api.github.com/users/xcat2/followers","following_url":"https://api.github.com/users/xcat2/following{/other_user}","gists_url":"https://api.github.com/users/xcat2/gists{/gist_id}","starred_url":"https://api.github.com/users/xcat2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xcat2/subscriptions","organizations_url":"https://api.github.com/users/xcat2/orgs","repos_url":"https://api.github.com/users/xcat2/repos","events_url":"https://api.github.com/users/xcat2/events{/privacy}","received_events_url":"https://api.github.com/users/xcat2/received_events","type":"Organization","site_admin":false},"repo":{"id":27747508,"name":"xcat-core","full_name":"xcat2/xcat-core","owner":{"login":"xcat2","id":10124414,"avatar_url":"https://avatars.githubusercontent.com/u/10124414?v=3","gravatar_id":"","url":"https://api.github.com/users/xcat2","html_url":"https://github.com/xcat2","followers_url":"https://api.github.com/users/xcat2/followers","following_url":"https://api.github.com/users/xcat2/following{/other_user}","gists_url":"https://api.github.com/users/xcat2/gists{/gist_id}","starred_url":"https://api.github.com/users/xcat2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xcat2/subscriptions","organizations_url":"https://api.github.com/users/xcat2/orgs","repos_url":"https://api.github.com/users/xcat2/repos","events_url":"https://api.github.com/users/xcat2/events{/privacy}","received_events_url":"https://api.github.com/users/xcat2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xcat2/xcat-core","description":"Code repo for xCAT core packages","fork":false,"url":"https://api.github.com/repos/xcat2/xcat-core","forks_url":"https://api.github.com/repos/xcat2/xcat-core/forks","keys_url":"https://api.github.com/repos/xcat2/xcat-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xcat2/xcat-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xcat2/xcat-core/teams","hooks_url":"https://api.github.com/repos/xcat2/xcat-core/hooks","issue_events_url":"https://api.github.com/repos/xcat2/xcat-core/issues/events{/number}","events_url":"https://api.github.com/repos/xcat2/xcat-core/events","assignees_url":"https://api.github.com/repos/xcat2/xcat-core/assignees{/user}","branches_url":"https://api.github.com/repos/xcat2/xcat-core/branches{/branch}","tags_url":"https://api.github.com/repos/xcat2/xcat-core/tags","blobs_url":"https://api.github.com/repos/xcat2/xcat-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xcat2/xcat-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xcat2/xcat-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/xcat2/xcat-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xcat2/xcat-core/statuses/{sha}","languages_url":"https://api.github.com/repos/xcat2/xcat-core/languages","stargazers_url":"https://api.github.com/repos/xcat2/xcat-core/stargazers","contributors_url":"https://api.github.com/repos/xcat2/xcat-core/contributors","subscribers_url":"https://api.github.com/repos/xcat2/xcat-core/subscribers","subscription_url":"https://api.github.com/repos/xcat2/xcat-core/subscription","commits_url":"https://api.github.com/repos/xcat2/xcat-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/xcat2/xcat-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/xcat2/xcat-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/xcat2/xcat-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/xcat2/xcat-core/contents/{+path}","compare_url":"https://api.github.com/repos/xcat2/xcat-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xcat2/xcat-core/merges","archive_url":"https://api.github.com/repos/xcat2/xcat-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xcat2/xcat-core/downloads","issues_url":"https://api.github.com/repos/xcat2/xcat-core/issues{/number}","pulls_url":"https://api.github.com/repos/xcat2/xcat-core/pulls{/number}","milestones_url":"https://api.github.com/repos/xcat2/xcat-core/milestones{/number}","notifications_url":"https://api.github.com/repos/xcat2/xcat-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xcat2/xcat-core/labels{/name}","releases_url":"https://api.github.com/repos/xcat2/xcat-core/releases{/id}","created_at":"2014-12-09T03:21:50Z","updated_at":"2015-11-23T03:34:22Z","pushed_at":"2015-11-23T07:13:17Z","git_url":"git://github.com/xcat2/xcat-core.git","ssh_url":"git@github.com:xcat2/xcat-core.git","clone_url":"https://github.com/xcat2/xcat-core.git","svn_url":"https://github.com/xcat2/xcat-core","homepage":null,"size":181371,"stargazers_count":19,"watchers_count":19,"language":"Perl","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":54,"forks":36,"open_issues":54,"watchers":19,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xcat2/xcat-core/pulls/452"},"html":{"href":"https://github.com/xcat2/xcat-core/pull/452"},"issue":{"href":"https://api.github.com/repos/xcat2/xcat-core/issues/452"},"comments":{"href":"https://api.github.com/repos/xcat2/xcat-core/issues/452/comments"},"review_comments":{"href":"https://api.github.com/repos/xcat2/xcat-core/pulls/452/comments"},"review_comment":{"href":"https://api.github.com/repos/xcat2/xcat-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xcat2/xcat-core/pulls/452/commits"},"statuses":{"href":"https://api.github.com/repos/xcat2/xcat-core/statuses/939773081c01321152624d200eea10ed9ead804b"}}}}