{"action":"created","comment":{"url":"https://api.github.com/repos/autotest/tp-qemu/pulls/comments/79983500","id":79983500,"diff_hunk":"@@ -0,0 +1,84 @@\n+import logging\n+import aexpect\n+\n+from virttest import error_context\n+from virttest import utils_test\n+from virttest.qemu_devices import qdevices\n+from avocado.core import exceptions\n+from avocado.utils import process\n+\n+\n+@error_context.context_aware\n+def run(test, params, env):\n+    \"\"\"\n+    1) Boot up vm with one or more rng devices\n+    2) Read from /dev/random in host (optional)\n+    3) Run random read in guest\n+    4) Switch rng device if there is more than on rng devices\n+    5) Run random read in guest\n+    6) Read from /dev/random in host (optional)\n+    7) Clean random read in host (optional)\n+    \"\"\"\n+\n+    def get_rng_list(vm):\n+        \"\"\"\n+        Get attached rng devices from device dictionary\n+        \"\"\"\n+        rng_list = []\n+        for device in vm.devices:\n+            if isinstance(device, qdevices.QDevice):\n+                if device.get_param(\"driver\") == \"virtio-rng-pci\":\n+                    rng_list.append(device)\n+        return rng_list\n+\n+    def get_available_rng(session):\n+        \"\"\"\n+        Get available rng devices from /sys/devices\n+        \"\"\"\n+        verify_cmd = params[\"driver_available_cmd\"]\n+        try:\n+            rng_devices = session.cmd_output_status(verify_cmd)\n+        except aexpect.ShellTimeoutError:\n+            err = \"%s timeout, pls check if it's a product bug\" % verify_cmd\n+            raise exceptions.TestFail(err)\n+        rng_devices = rng_devices.split()\n+        return rng_devices\n+\n+    login_timeout = int(params.get(\"login_timeout\", 360))\n+    vm = env.get_vm(params[\"main_vm\"])\n+    vm.verify_alive()\n+    session = vm.wait_for_login(timeout=login_timeout)\n+    sub_test = params.get(\"sub_test\")\n+\n+    if params.get(\"pre_cmd\"):\n+        error_context.context(\"Fetch data from host\", logging.info)\n+        utils.system(params.get(\"pre_cmd\"))","path":"qemu/tests/rng_stress.py","position":55,"original_position":55,"commit_id":"8a49584e7173491cb35542a638870ace680a9ca6","original_commit_id":"8a49584e7173491cb35542a638870ace680a9ca6","user":{"login":"pingl2016","id":16647162,"avatar_url":"https://avatars.githubusercontent.com/u/16647162?v=3","gravatar_id":"","url":"https://api.github.com/users/pingl2016","html_url":"https://github.com/pingl2016","followers_url":"https://api.github.com/users/pingl2016/followers","following_url":"https://api.github.com/users/pingl2016/following{/other_user}","gists_url":"https://api.github.com/users/pingl2016/gists{/gist_id}","starred_url":"https://api.github.com/users/pingl2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingl2016/subscriptions","organizations_url":"https://api.github.com/users/pingl2016/orgs","repos_url":"https://api.github.com/users/pingl2016/repos","events_url":"https://api.github.com/users/pingl2016/events{/privacy}","received_events_url":"https://api.github.com/users/pingl2016/received_events","type":"User","site_admin":false},"body":"module utils has no import","created_at":"2016-09-22T06:52:22Z","updated_at":"2016-09-22T06:52:31Z","html_url":"https://github.com/autotest/tp-qemu/pull/748#discussion_r79983500","pull_request_url":"https://api.github.com/repos/autotest/tp-qemu/pulls/748","_links":{"self":{"href":"https://api.github.com/repos/autotest/tp-qemu/pulls/comments/79983500"},"html":{"href":"https://github.com/autotest/tp-qemu/pull/748#discussion_r79983500"},"pull_request":{"href":"https://api.github.com/repos/autotest/tp-qemu/pulls/748"}}},"pull_request":{"url":"https://api.github.com/repos/autotest/tp-qemu/pulls/748","id":85016182,"html_url":"https://github.com/autotest/tp-qemu/pull/748","diff_url":"https://github.com/autotest/tp-qemu/pull/748.diff","patch_url":"https://github.com/autotest/tp-qemu/pull/748.patch","issue_url":"https://api.github.com/repos/autotest/tp-qemu/issues/748","number":748,"state":"open","locked":false,"title":"Add more scenerios to rng device test","user":{"login":"suqinhuang","id":3124468,"avatar_url":"https://avatars.githubusercontent.com/u/3124468?v=3","gravatar_id":"","url":"https://api.github.com/users/suqinhuang","html_url":"https://github.com/suqinhuang","followers_url":"https://api.github.com/users/suqinhuang/followers","following_url":"https://api.github.com/users/suqinhuang/following{/other_user}","gists_url":"https://api.github.com/users/suqinhuang/gists{/gist_id}","starred_url":"https://api.github.com/users/suqinhuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suqinhuang/subscriptions","organizations_url":"https://api.github.com/users/suqinhuang/orgs","repos_url":"https://api.github.com/users/suqinhuang/repos","events_url":"https://api.github.com/users/suqinhuang/events{/privacy}","received_events_url":"https://api.github.com/users/suqinhuang/received_events","type":"User","site_admin":false},"body":"1. Fetch data from /dev/random in guest and host at the same time\r\n2. Switch rng device and fetch data\r\n\r\nSigned-off-by: Suqin Huang <shuang@redhat.com>","created_at":"2016-09-13T09:46:26Z","updated_at":"2016-09-22T06:52:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"90266a6ec35edc914e597a24e1aab210499bc697","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/autotest/tp-qemu/pulls/748/commits","review_comments_url":"https://api.github.com/repos/autotest/tp-qemu/pulls/748/comments","review_comment_url":"https://api.github.com/repos/autotest/tp-qemu/pulls/comments{/number}","comments_url":"https://api.github.com/repos/autotest/tp-qemu/issues/748/comments","statuses_url":"https://api.github.com/repos/autotest/tp-qemu/statuses/8a49584e7173491cb35542a638870ace680a9ca6","head":{"label":"suqinhuang:rng_stress","ref":"rng_stress","sha":"8a49584e7173491cb35542a638870ace680a9ca6","user":{"login":"suqinhuang","id":3124468,"avatar_url":"https://avatars.githubusercontent.com/u/3124468?v=3","gravatar_id":"","url":"https://api.github.com/users/suqinhuang","html_url":"https://github.com/suqinhuang","followers_url":"https://api.github.com/users/suqinhuang/followers","following_url":"https://api.github.com/users/suqinhuang/following{/other_user}","gists_url":"https://api.github.com/users/suqinhuang/gists{/gist_id}","starred_url":"https://api.github.com/users/suqinhuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suqinhuang/subscriptions","organizations_url":"https://api.github.com/users/suqinhuang/orgs","repos_url":"https://api.github.com/users/suqinhuang/repos","events_url":"https://api.github.com/users/suqinhuang/events{/privacy}","received_events_url":"https://api.github.com/users/suqinhuang/received_events","type":"User","site_admin":false},"repo":{"id":37175018,"name":"tp-qemu","full_name":"suqinhuang/tp-qemu","owner":{"login":"suqinhuang","id":3124468,"avatar_url":"https://avatars.githubusercontent.com/u/3124468?v=3","gravatar_id":"","url":"https://api.github.com/users/suqinhuang","html_url":"https://github.com/suqinhuang","followers_url":"https://api.github.com/users/suqinhuang/followers","following_url":"https://api.github.com/users/suqinhuang/following{/other_user}","gists_url":"https://api.github.com/users/suqinhuang/gists{/gist_id}","starred_url":"https://api.github.com/users/suqinhuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suqinhuang/subscriptions","organizations_url":"https://api.github.com/users/suqinhuang/orgs","repos_url":"https://api.github.com/users/suqinhuang/repos","events_url":"https://api.github.com/users/suqinhuang/events{/privacy}","received_events_url":"https://api.github.com/users/suqinhuang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/suqinhuang/tp-qemu","description":"Virt Test Provider for qemu and other related virtualization backends","fork":true,"url":"https://api.github.com/repos/suqinhuang/tp-qemu","forks_url":"https://api.github.com/repos/suqinhuang/tp-qemu/forks","keys_url":"https://api.github.com/repos/suqinhuang/tp-qemu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/suqinhuang/tp-qemu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/suqinhuang/tp-qemu/teams","hooks_url":"https://api.github.com/repos/suqinhuang/tp-qemu/hooks","issue_events_url":"https://api.github.com/repos/suqinhuang/tp-qemu/issues/events{/number}","events_url":"https://api.github.com/repos/suqinhuang/tp-qemu/events","assignees_url":"https://api.github.com/repos/suqinhuang/tp-qemu/assignees{/user}","branches_url":"https://api.github.com/repos/suqinhuang/tp-qemu/branches{/branch}","tags_url":"https://api.github.com/repos/suqinhuang/tp-qemu/tags","blobs_url":"https://api.github.com/repos/suqinhuang/tp-qemu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/suqinhuang/tp-qemu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/suqinhuang/tp-qemu/git/refs{/sha}","trees_url":"https://api.github.com/repos/suqinhuang/tp-qemu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/suqinhuang/tp-qemu/statuses/{sha}","languages_url":"https://api.github.com/repos/suqinhuang/tp-qemu/languages","stargazers_url":"https://api.github.com/repos/suqinhuang/tp-qemu/stargazers","contributors_url":"https://api.github.com/repos/suqinhuang/tp-qemu/contributors","subscribers_url":"https://api.github.com/repos/suqinhuang/tp-qemu/subscribers","subscription_url":"https://api.github.com/repos/suqinhuang/tp-qemu/subscription","commits_url":"https://api.github.com/repos/suqinhuang/tp-qemu/commits{/sha}","git_commits_url":"https://api.github.com/repos/suqinhuang/tp-qemu/git/commits{/sha}","comments_url":"https://api.github.com/repos/suqinhuang/tp-qemu/comments{/number}","issue_comment_url":"https://api.github.com/repos/suqinhuang/tp-qemu/issues/comments{/number}","contents_url":"https://api.github.com/repos/suqinhuang/tp-qemu/contents/{+path}","compare_url":"https://api.github.com/repos/suqinhuang/tp-qemu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/suqinhuang/tp-qemu/merges","archive_url":"https://api.github.com/repos/suqinhuang/tp-qemu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/suqinhuang/tp-qemu/downloads","issues_url":"https://api.github.com/repos/suqinhuang/tp-qemu/issues{/number}","pulls_url":"https://api.github.com/repos/suqinhuang/tp-qemu/pulls{/number}","milestones_url":"https://api.github.com/repos/suqinhuang/tp-qemu/milestones{/number}","notifications_url":"https://api.github.com/repos/suqinhuang/tp-qemu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/suqinhuang/tp-qemu/labels{/name}","releases_url":"https://api.github.com/repos/suqinhuang/tp-qemu/releases{/id}","deployments_url":"https://api.github.com/repos/suqinhuang/tp-qemu/deployments","created_at":"2015-06-10T04:17:56Z","updated_at":"2015-06-10T04:17:58Z","pushed_at":"2016-09-21T05:28:43Z","git_url":"git://github.com/suqinhuang/tp-qemu.git","ssh_url":"git@github.com:suqinhuang/tp-qemu.git","clone_url":"https://github.com/suqinhuang/tp-qemu.git","svn_url":"https://github.com/suqinhuang/tp-qemu","homepage":null,"size":11559,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"autotest:master","ref":"master","sha":"90c58178e7bbe6f0d3d1dab0b6d7f8fd355f42a8","user":{"login":"autotest","id":472856,"avatar_url":"https://avatars.githubusercontent.com/u/472856?v=3","gravatar_id":"","url":"https://api.github.com/users/autotest","html_url":"https://github.com/autotest","followers_url":"https://api.github.com/users/autotest/followers","following_url":"https://api.github.com/users/autotest/following{/other_user}","gists_url":"https://api.github.com/users/autotest/gists{/gist_id}","starred_url":"https://api.github.com/users/autotest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autotest/subscriptions","organizations_url":"https://api.github.com/users/autotest/orgs","repos_url":"https://api.github.com/users/autotest/repos","events_url":"https://api.github.com/users/autotest/events{/privacy}","received_events_url":"https://api.github.com/users/autotest/received_events","type":"Organization","site_admin":false},"repo":{"id":16180304,"name":"tp-qemu","full_name":"autotest/tp-qemu","owner":{"login":"autotest","id":472856,"avatar_url":"https://avatars.githubusercontent.com/u/472856?v=3","gravatar_id":"","url":"https://api.github.com/users/autotest","html_url":"https://github.com/autotest","followers_url":"https://api.github.com/users/autotest/followers","following_url":"https://api.github.com/users/autotest/following{/other_user}","gists_url":"https://api.github.com/users/autotest/gists{/gist_id}","starred_url":"https://api.github.com/users/autotest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autotest/subscriptions","organizations_url":"https://api.github.com/users/autotest/orgs","repos_url":"https://api.github.com/users/autotest/repos","events_url":"https://api.github.com/users/autotest/events{/privacy}","received_events_url":"https://api.github.com/users/autotest/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/autotest/tp-qemu","description":"Virt Test Provider for qemu and other related virtualization backends","fork":false,"url":"https://api.github.com/repos/autotest/tp-qemu","forks_url":"https://api.github.com/repos/autotest/tp-qemu/forks","keys_url":"https://api.github.com/repos/autotest/tp-qemu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/autotest/tp-qemu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/autotest/tp-qemu/teams","hooks_url":"https://api.github.com/repos/autotest/tp-qemu/hooks","issue_events_url":"https://api.github.com/repos/autotest/tp-qemu/issues/events{/number}","events_url":"https://api.github.com/repos/autotest/tp-qemu/events","assignees_url":"https://api.github.com/repos/autotest/tp-qemu/assignees{/user}","branches_url":"https://api.github.com/repos/autotest/tp-qemu/branches{/branch}","tags_url":"https://api.github.com/repos/autotest/tp-qemu/tags","blobs_url":"https://api.github.com/repos/autotest/tp-qemu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/autotest/tp-qemu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/autotest/tp-qemu/git/refs{/sha}","trees_url":"https://api.github.com/repos/autotest/tp-qemu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/autotest/tp-qemu/statuses/{sha}","languages_url":"https://api.github.com/repos/autotest/tp-qemu/languages","stargazers_url":"https://api.github.com/repos/autotest/tp-qemu/stargazers","contributors_url":"https://api.github.com/repos/autotest/tp-qemu/contributors","subscribers_url":"https://api.github.com/repos/autotest/tp-qemu/subscribers","subscription_url":"https://api.github.com/repos/autotest/tp-qemu/subscription","commits_url":"https://api.github.com/repos/autotest/tp-qemu/commits{/sha}","git_commits_url":"https://api.github.com/repos/autotest/tp-qemu/git/commits{/sha}","comments_url":"https://api.github.com/repos/autotest/tp-qemu/comments{/number}","issue_comment_url":"https://api.github.com/repos/autotest/tp-qemu/issues/comments{/number}","contents_url":"https://api.github.com/repos/autotest/tp-qemu/contents/{+path}","compare_url":"https://api.github.com/repos/autotest/tp-qemu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/autotest/tp-qemu/merges","archive_url":"https://api.github.com/repos/autotest/tp-qemu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/autotest/tp-qemu/downloads","issues_url":"https://api.github.com/repos/autotest/tp-qemu/issues{/number}","pulls_url":"https://api.github.com/repos/autotest/tp-qemu/pulls{/number}","milestones_url":"https://api.github.com/repos/autotest/tp-qemu/milestones{/number}","notifications_url":"https://api.github.com/repos/autotest/tp-qemu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/autotest/tp-qemu/labels{/name}","releases_url":"https://api.github.com/repos/autotest/tp-qemu/releases{/id}","deployments_url":"https://api.github.com/repos/autotest/tp-qemu/deployments","created_at":"2014-01-23T17:51:34Z","updated_at":"2016-08-25T01:57:00Z","pushed_at":"2016-09-22T06:28:27Z","git_url":"git://github.com/autotest/tp-qemu.git","ssh_url":"git@github.com:autotest/tp-qemu.git","clone_url":"https://github.com/autotest/tp-qemu.git","svn_url":"https://github.com/autotest/tp-qemu","homepage":null,"size":12186,"stargazers_count":14,"watchers_count":14,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":71,"mirror_url":null,"open_issues_count":33,"forks":71,"open_issues":33,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/autotest/tp-qemu/pulls/748"},"html":{"href":"https://github.com/autotest/tp-qemu/pull/748"},"issue":{"href":"https://api.github.com/repos/autotest/tp-qemu/issues/748"},"comments":{"href":"https://api.github.com/repos/autotest/tp-qemu/issues/748/comments"},"review_comments":{"href":"https://api.github.com/repos/autotest/tp-qemu/pulls/748/comments"},"review_comment":{"href":"https://api.github.com/repos/autotest/tp-qemu/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/autotest/tp-qemu/pulls/748/commits"},"statuses":{"href":"https://api.github.com/repos/autotest/tp-qemu/statuses/8a49584e7173491cb35542a638870ace680a9ca6"}}}}
{"actor":{"display_login":"pingl2016"}}