GitHub PullRequestReviewCommentEvent at 2014-06-27 03:15:58
Repository: tp-qemu
Actor: xutian
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/autotest/tp-qemu/pulls/comments/14278292","id":14278292,"diff_hunk":"@@ -0,0 +1,103 @@\n+import logging\n+import time\n+from autotest.client.shared import error, utils\n+from virttest import utils_misc, utils_net, env_process\n+\n+\n+@error.context_aware\n+def run(test, params, env):\n+    \"\"\"\n+    Test qmp event notification function:\n+    1) Boot up guest with qmp and macvtap.\n+    2) In guest, change network interface to promisc state.\n+    3) Try to catch qmp event notification in qmp monitor.\n+    4) Execute query-rx-filter in host qmp session.\n+\n+    :param test: QEMU test object\n+    :param params: Dictionary with the test parameters\n+    :param env: Dictionary with test environmen.\n+    \"\"\"\n+\n+    if not utils_misc.qemu_has_option(\"qmp\"):\n+        error.TestNAError(\"This test case requires a host QEMU with QMP \"\n+                          \"monitor support\")\n+    if params.get(\"nettype\", \"macvtap\") != \"macvtap\":\n+        error.TestNAError(\"This test case test macvtap.\")\n+\n+    params[\"start_vm\"] = \"yes\"\n+    vm_name = params.get(\"main_vm\", \"vm1\")\n+    env_process.preprocess_vm(test, params, env, vm_name)\n+\n+    vm = env.get_vm(vm_name)\n+    vm.verify_alive()\n+\n+    event_cmd = params.get(\"event_cmd\")\n+    event_cmd_type = params.get(\"event_cmd_type\")\n+    event_check = params.get(\"event_check\")\n+    timeout = int(params.get(\"check_timeout\", 360))\n+    action_check = params.get(\"action_check\")\n+    pre_cmd = params.get(\"pre_cmd\")\n+    post_cmd = params.get(\"post_cmd\")\n+    post_cmd_type = params.get(\"post_cmd_type\")\n+\n+    session = vm.wait_for_serial_login(timeout=int(params.get(\"login_timeout\",\n+                                                              360)))\n+\n+    callback = {\"host_cmd\": utils.system_output,\n+                \"guest_cmd\": session.get_command_output,\n+                \"monitor_cmd\": vm.monitor.send_args_cmd,\n+                \"qmp_cmd\": vm.monitors[1].send_args_cmd}\n+\n+    def send_cmd(cmd, cmd_type):\n+        if cmd_type in callback.keys():\n+            return callback[cmd_type](cmd)\n+        else:\n+            raise error.TestError(\"cmd_type is not supported\")\n+\n+    if pre_cmd:\n+        error.context(\"Run pre_cmd '%s'\", logging.info)\n+        pre_cmd_type = params.get(\"pre_cmd_type\", event_cmd_type)\n+        send_cmd(pre_cmd, pre_cmd_type)\n+\n+    mac = vm.get_mac_address()\n+    interface_name = utils_net.get_linux_ifname(session, mac)\n+    error.context(\"In guest, change network interface to promisc state.\",\n+                  logging.info)\n+    event_cmd = params.get(\"event_cmd\") % interface_name\n+    send_cmd(event_cmd, event_cmd_type)\n+\n+    error.context(\"Try to get qmp events in %s seconds!\" % timeout,\n+                  logging.info)\n+    end_time = time.time() + timeout\n+    qmp_monitors = vm.get_monitors_by_type(\"qmp\")\n+    qmp_num = len(qmp_monitors)\n+    while time.time() < end_time:\n+        for monitor in qmp_monitors:\n+            event = monitor.get_event(event_check)\n+            if event:\n+                logging.info(\"Receive qmp %s event notification\",\n+                             event_check)\n+                qmp_num -= 1\n+                qmp_monitors.remove(monitor)\n+        time.sleep(5)\n+        if qmp_num <= 0:\n+            break\n+    if qmp_num > 0:\n+        raise error.TestFail(\"Did not receive qmp %s event notification\"","path":"qemu/tests/macvtap_event_notification.py","position":86,"original_position":86,"commit_id":"be042f4473bb93d629e1285f081ba525400c9d74","original_commit_id":"be042f4473bb93d629e1285f081ba525400c9d74","user":{"login":"xutian","id":1871732,"avatar_url":"https://avatars.githubusercontent.com/u/1871732?","gravatar_id":"3a7482df3555653e0506318f699edfa7","url":"https://api.github.com/users/xutian","html_url":"https://github.com/xutian","followers_url":"https://api.github.com/users/xutian/followers","following_url":"https://api.github.com/users/xutian/following{/other_user}","gists_url":"https://api.github.com/users/xutian/gists{/gist_id}","starred_url":"https://api.github.com/users/xutian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xutian/subscriptions","organizations_url":"https://api.github.com/users/xutian/orgs","repos_url":"https://api.github.com/users/xutian/repos","events_url":"https://api.github.com/users/xutian/events{/privacy}","received_events_url":"https://api.github.com/users/xutian/received_events","type":"User","site_admin":false},"body":"It's better to logging monitor name to debug file, it that monitor not receive  the event. ","created_at":"2014-06-27T03:15:58Z","updated_at":"2014-06-27T03:15:58Z","html_url":"https://github.com/autotest/tp-qemu/pull/121#discussion_r14278292","pull_request_url":"https://api.github.com/repos/autotest/tp-qemu/pulls/121","_links":{"self":{"href":"https://api.github.com/repos/autotest/tp-qemu/pulls/comments/14278292"},"html":{"href":"https://github.com/autotest/tp-qemu/pull/121#discussion_r14278292"},"pull_request":{"href":"https://api.github.com/repos/autotest/tp-qemu/pulls/121"}}},"pull_request":{"url":"https://api.github.com/repos/autotest/tp-qemu/pulls/121","id":17398375,"html_url":"https://github.com/autotest/tp-qemu/pull/121","diff_url":"https://github.com/autotest/tp-qemu/pull/121.diff","patch_url":"https://github.com/autotest/tp-qemu/pull/121.patch","issue_url":"https://api.github.com/repos/autotest/tp-qemu/issues/121","number":121,"state":"open","title":"qemu.tests: Add macvtap_event_notification new test case","user":{"login":"FengYang","id":1224382,"avatar_url":"https://avatars.githubusercontent.com/u/1224382?","gravatar_id":"5fff64d4f206f851735037dd8cd31eec","url":"https://api.github.com/users/FengYang","html_url":"https://github.com/FengYang","followers_url":"https://api.github.com/users/FengYang/followers","following_url":"https://api.github.com/users/FengYang/following{/other_user}","gists_url":"https://api.github.com/users/FengYang/gists{/gist_id}","starred_url":"https://api.github.com/users/FengYang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FengYang/subscriptions","organizations_url":"https://api.github.com/users/FengYang/orgs","repos_url":"https://api.github.com/users/FengYang/repos","events_url":"https://api.github.com/users/FengYang/events{/privacy}","received_events_url":"https://api.github.com/users/FengYang/received_events","type":"User","site_admin":false},"body":"Signed-off-by: Feng Yang <fyang@redhat.com>","created_at":"2014-06-20T10:21:50Z","updated_at":"2014-06-27T03:15:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"22668d9ad31556686372067b78845d97e0c9c980","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/autotest/tp-qemu/pulls/121/commits","review_comments_url":"https://api.github.com/repos/autotest/tp-qemu/pulls/121/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/121/comments","statuses_url":"https://api.github.com/repos/autotest/tp-qemu/statuses/be042f4473bb93d629e1285f081ba525400c9d74","head":{"label":"FengYang:macvtap","ref":"macvtap","sha":"be042f4473bb93d629e1285f081ba525400c9d74","user":{"login":"FengYang","id":1224382,"avatar_url":"https://avatars.githubusercontent.com/u/1224382?","gravatar_id":"5fff64d4f206f851735037dd8cd31eec","url":"https://api.github.com/users/FengYang","html_url":"https://github.com/FengYang","followers_url":"https://api.github.com/users/FengYang/followers","following_url":"https://api.github.com/users/FengYang/following{/other_user}","gists_url":"https://api.github.com/users/FengYang/gists{/gist_id}","starred_url":"https://api.github.com/users/FengYang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FengYang/subscriptions","organizations_url":"https://api.github.com/users/FengYang/orgs","repos_url":"https://api.github.com/users/FengYang/repos","events_url":"https://api.github.com/users/FengYang/events{/privacy}","received_events_url":"https://api.github.com/users/FengYang/received_events","type":"User","site_admin":false},"repo":{"id":16301189,"name":"tp-qemu","full_name":"FengYang/tp-qemu","owner":{"login":"FengYang","id":1224382,"avatar_url":"https://avatars.githubusercontent.com/u/1224382?","gravatar_id":"5fff64d4f206f851735037dd8cd31eec","url":"https://api.github.com/users/FengYang","html_url":"https://github.com/FengYang","followers_url":"https://api.github.com/users/FengYang/followers","following_url":"https://api.github.com/users/FengYang/following{/other_user}","gists_url":"https://api.github.com/users/FengYang/gists{/gist_id}","starred_url":"https://api.github.com/users/FengYang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FengYang/subscriptions","organizations_url":"https://api.github.com/users/FengYang/orgs","repos_url":"https://api.github.com/users/FengYang/repos","events_url":"https://api.github.com/users/FengYang/events{/privacy}","received_events_url":"https://api.github.com/users/FengYang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/FengYang/tp-qemu","description":"Virt Test Provider for qemu and other related virtualization backends","fork":true,"url":"https://api.github.com/repos/FengYang/tp-qemu","forks_url":"https://api.github.com/repos/FengYang/tp-qemu/forks","keys_url":"https://api.github.com/repos/FengYang/tp-qemu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FengYang/tp-qemu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FengYang/tp-qemu/teams","hooks_url":"https://api.github.com/repos/FengYang/tp-qemu/hooks","issue_events_url":"https://api.github.com/repos/FengYang/tp-qemu/issues/events{/number}","events_url":"https://api.github.com/repos/FengYang/tp-qemu/events","assignees_url":"https://api.github.com/repos/FengYang/tp-qemu/assignees{/user}","branches_url":"https://api.github.com/repos/FengYang/tp-qemu/branches{/branch}","tags_url":"https://api.github.com/repos/FengYang/tp-qemu/tags","blobs_url":"https://api.github.com/repos/FengYang/tp-qemu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FengYang/tp-qemu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FengYang/tp-qemu/git/refs{/sha}","trees_url":"https://api.github.com/repos/FengYang/tp-qemu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FengYang/tp-qemu/statuses/{sha}","languages_url":"https://api.github.com/repos/FengYang/tp-qemu/languages","stargazers_url":"https://api.github.com/repos/FengYang/tp-qemu/stargazers","contributors_url":"https://api.github.com/repos/FengYang/tp-qemu/contributors","subscribers_url":"https://api.github.com/repos/FengYang/tp-qemu/subscribers","subscription_url":"https://api.github.com/repos/FengYang/tp-qemu/subscription","commits_url":"https://api.github.com/repos/FengYang/tp-qemu/commits{/sha}","git_commits_url":"https://api.github.com/repos/FengYang/tp-qemu/git/commits{/sha}","comments_url":"https://api.github.com/repos/FengYang/tp-qemu/comments{/number}","issue_comment_url":"https://api.github.com/repos/FengYang/tp-qemu/issues/comments/{number}","contents_url":"https://api.github.com/repos/FengYang/tp-qemu/contents/{+path}","compare_url":"https://api.github.com/repos/FengYang/tp-qemu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FengYang/tp-qemu/merges","archive_url":"https://api.github.com/repos/FengYang/tp-qemu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FengYang/tp-qemu/downloads","issues_url":"https://api.github.com/repos/FengYang/tp-qemu/issues{/number}","pulls_url":"https://api.github.com/repos/FengYang/tp-qemu/pulls{/number}","milestones_url":"https://api.github.com/repos/FengYang/tp-qemu/milestones{/number}","notifications_url":"https://api.github.com/repos/FengYang/tp-qemu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FengYang/tp-qemu/labels{/name}","releases_url":"https://api.github.com/repos/FengYang/tp-qemu/releases{/id}","created_at":"2014-01-28T03:34:52Z","updated_at":"2014-06-25T07:54:08Z","pushed_at":"2014-06-26T08:21:13Z","git_url":"git://github.com/FengYang/tp-qemu.git","ssh_url":"git@github.com:FengYang/tp-qemu.git","clone_url":"https://github.com/FengYang/tp-qemu.git","svn_url":"https://github.com/FengYang/tp-qemu","homepage":null,"size":9481,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"66d3a0d4c840f24b727aba86990885c1dc3bd5ed","user":{"login":"autotest","id":472856,"avatar_url":"https://avatars.githubusercontent.com/u/472856?","gravatar_id":"276c864911264411989b6720fd80f611","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?","gravatar_id":"276c864911264411989b6720fd80f611","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}","created_at":"2014-01-23T17:51:34Z","updated_at":"2014-06-26T06:05:23Z","pushed_at":"2014-06-26T06:05:20Z","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":11786,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"forks_count":25,"mirror_url":null,"open_issues_count":27,"forks":25,"open_issues":27,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/autotest/tp-qemu/pulls/121"},"html":{"href":"https://github.com/autotest/tp-qemu/pull/121"},"issue":{"href":"https://api.github.com/repos/autotest/tp-qemu/issues/121"},"comments":{"href":"https://api.github.com/repos/autotest/tp-qemu/issues/121/comments"},"review_comments":{"href":"https://api.github.com/repos/autotest/tp-qemu/pulls/121/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/121/commits"},"statuses":{"href":"https://api.github.com/repos/autotest/tp-qemu/statuses/be042f4473bb93d629e1285f081ba525400c9d74"}}}}