{"action":"created","comment":{"url":"https://api.github.com/repos/avocado-framework/avocado-vt/pulls/comments/66904354","id":66904354,"diff_hunk":"@@ -3790,62 +3790,86 @@ def reboot(self, session=None, method=\"shell\", nic_index=0,\n         :param serial: Serial login or not (default is False).\n         :return: A new shell session object.\n         \"\"\"\n-        def __reboot(session):\n+\n+        def __get_session(nic_index=0, serial=False):\n+            \"\"\"\n+            Get connection to VM\n+            \"\"\"\n+            if serial:\n+                return self.serial_login()\n+            return self.login(nic_index=nic_index)\n+\n+        def __go_down(session, nic_index, serial):\n             \"\"\"\n             Check guest rebooting.\n             \"\"\"\n+            timeout = self.CLOSE_SESSION_TIMEOUT\n+            try:\n+                if serial:\n+                    patterns = [r\".*[Rr]ebooting.*\", r\".*[Rr]estarting system.*\",\n+                                r\".*[Mm]achine restart.*\", r\".*Linux version.*\"]\n+                    if session.read_until_any_line_matches(\n+                            patterns, timeout=timeout):\n+                        session.close()\n+                        return True\n+                else:\n+                    session = __get_session(nic_index, serial)\n+                    session.close()\n+                    return False\n+            except (remote.LoginError, aexpect.ShellError):\n+                return True\n+            return False\n+\n+        def wait_for_go_down(session, nic_index, serial, timeout):\n+            \"\"\" Wait for VM go down\n+            :param session: VM session object\n+            :param nic_index: which nic what to login VM\n+            :param serial: login VM via serial console or not\n+            :param timeout: timeout wait for VM go down\n+            \"\"\"\n+            if not utils_misc.wait_for(\n+                    lambda: __go_down(session, nic_index, serial),\n+                    timeout=timeout):","path":"virttest/qemu_vm.py","position":44,"original_position":44,"commit_id":"c09e0fdb33e26e98bcfe12cf85f931e1f39e26a7","original_commit_id":"687e7eb420c644831fdb8f4bb49b041a2b2a4f17","user":{"login":"xutian","id":1871732,"avatar_url":"https://avatars.githubusercontent.com/u/1871732?v=3","gravatar_id":"","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":"timeout is arg for wait_for function, not for __go_down.","created_at":"2016-06-14T03:29:38Z","updated_at":"2016-06-14T03:29:38Z","html_url":"https://github.com/avocado-framework/avocado-vt/pull/556#discussion_r66904354","pull_request_url":"https://api.github.com/repos/avocado-framework/avocado-vt/pulls/556","_links":{"self":{"href":"https://api.github.com/repos/avocado-framework/avocado-vt/pulls/comments/66904354"},"html":{"href":"https://github.com/avocado-framework/avocado-vt/pull/556#discussion_r66904354"},"pull_request":{"href":"https://api.github.com/repos/avocado-framework/avocado-vt/pulls/556"}}},"pull_request":{"url":"https://api.github.com/repos/avocado-framework/avocado-vt/pulls/556","id":72682340,"html_url":"https://github.com/avocado-framework/avocado-vt/pull/556","diff_url":"https://github.com/avocado-framework/avocado-vt/pull/556.diff","patch_url":"https://github.com/avocado-framework/avocado-vt/pull/556.patch","issue_url":"https://api.github.com/repos/avocado-framework/avocado-vt/issues/556","number":556,"state":"open","locked":false,"title":"virttest.qemu_vm: fix use disconnect session in reboot","user":{"login":"xutian","id":1871732,"avatar_url":"https://avatars.githubusercontent.com/u/1871732?v=3","gravatar_id":"","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":"disconnect session object used caused server-runing-lock\r\nfile not found error.\r\n\r\nSigned-off-by: Xu Tian <xutian@redhat.com>","created_at":"2016-06-06T09:48:22Z","updated_at":"2016-06-14T03:29:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6ed977442259a5d48475a31a952c750dc187da89","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/avocado-framework/avocado-vt/pulls/556/commits","review_comments_url":"https://api.github.com/repos/avocado-framework/avocado-vt/pulls/556/comments","review_comment_url":"https://api.github.com/repos/avocado-framework/avocado-vt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/avocado-framework/avocado-vt/issues/556/comments","statuses_url":"https://api.github.com/repos/avocado-framework/avocado-vt/statuses/c09e0fdb33e26e98bcfe12cf85f931e1f39e26a7","head":{"label":"xutian:fix_reboot","ref":"fix_reboot","sha":"c09e0fdb33e26e98bcfe12cf85f931e1f39e26a7","user":{"login":"xutian","id":1871732,"avatar_url":"https://avatars.githubusercontent.com/u/1871732?v=3","gravatar_id":"","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},"repo":{"id":40173876,"name":"avocado-vt","full_name":"xutian/avocado-vt","owner":{"login":"xutian","id":1871732,"avatar_url":"https://avatars.githubusercontent.com/u/1871732?v=3","gravatar_id":"","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},"private":false,"html_url":"https://github.com/xutian/avocado-vt","description":"Avocado VT Plugin","fork":true,"url":"https://api.github.com/repos/xutian/avocado-vt","forks_url":"https://api.github.com/repos/xutian/avocado-vt/forks","keys_url":"https://api.github.com/repos/xutian/avocado-vt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xutian/avocado-vt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xutian/avocado-vt/teams","hooks_url":"https://api.github.com/repos/xutian/avocado-vt/hooks","issue_events_url":"https://api.github.com/repos/xutian/avocado-vt/issues/events{/number}","events_url":"https://api.github.com/repos/xutian/avocado-vt/events","assignees_url":"https://api.github.com/repos/xutian/avocado-vt/assignees{/user}","branches_url":"https://api.github.com/repos/xutian/avocado-vt/branches{/branch}","tags_url":"https://api.github.com/repos/xutian/avocado-vt/tags","blobs_url":"https://api.github.com/repos/xutian/avocado-vt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xutian/avocado-vt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xutian/avocado-vt/git/refs{/sha}","trees_url":"https://api.github.com/repos/xutian/avocado-vt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xutian/avocado-vt/statuses/{sha}","languages_url":"https://api.github.com/repos/xutian/avocado-vt/languages","stargazers_url":"https://api.github.com/repos/xutian/avocado-vt/stargazers","contributors_url":"https://api.github.com/repos/xutian/avocado-vt/contributors","subscribers_url":"https://api.github.com/repos/xutian/avocado-vt/subscribers","subscription_url":"https://api.github.com/repos/xutian/avocado-vt/subscription","commits_url":"https://api.github.com/repos/xutian/avocado-vt/commits{/sha}","git_commits_url":"https://api.github.com/repos/xutian/avocado-vt/git/commits{/sha}","comments_url":"https://api.github.com/repos/xutian/avocado-vt/comments{/number}","issue_comment_url":"https://api.github.com/repos/xutian/avocado-vt/issues/comments{/number}","contents_url":"https://api.github.com/repos/xutian/avocado-vt/contents/{+path}","compare_url":"https://api.github.com/repos/xutian/avocado-vt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xutian/avocado-vt/merges","archive_url":"https://api.github.com/repos/xutian/avocado-vt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xutian/avocado-vt/downloads","issues_url":"https://api.github.com/repos/xutian/avocado-vt/issues{/number}","pulls_url":"https://api.github.com/repos/xutian/avocado-vt/pulls{/number}","milestones_url":"https://api.github.com/repos/xutian/avocado-vt/milestones{/number}","notifications_url":"https://api.github.com/repos/xutian/avocado-vt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xutian/avocado-vt/labels{/name}","releases_url":"https://api.github.com/repos/xutian/avocado-vt/releases{/id}","deployments_url":"https://api.github.com/repos/xutian/avocado-vt/deployments","created_at":"2015-08-04T08:54:58Z","updated_at":"2015-08-04T08:55:00Z","pushed_at":"2016-06-14T02:16:53Z","git_url":"git://github.com/xutian/avocado-vt.git","ssh_url":"git@github.com:xutian/avocado-vt.git","clone_url":"https://github.com/xutian/avocado-vt.git","svn_url":"https://github.com/xutian/avocado-vt","homepage":"http://avocado-vt.readthedocs.org/","size":19416,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"avocado-framework:master","ref":"master","sha":"2e6cd4bec52346fe90bb44635b8baae2d60ca25a","user":{"login":"avocado-framework","id":7245719,"avatar_url":"https://avatars.githubusercontent.com/u/7245719?v=3","gravatar_id":"","url":"https://api.github.com/users/avocado-framework","html_url":"https://github.com/avocado-framework","followers_url":"https://api.github.com/users/avocado-framework/followers","following_url":"https://api.github.com/users/avocado-framework/following{/other_user}","gists_url":"https://api.github.com/users/avocado-framework/gists{/gist_id}","starred_url":"https://api.github.com/users/avocado-framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avocado-framework/subscriptions","organizations_url":"https://api.github.com/users/avocado-framework/orgs","repos_url":"https://api.github.com/users/avocado-framework/repos","events_url":"https://api.github.com/users/avocado-framework/events{/privacy}","received_events_url":"https://api.github.com/users/avocado-framework/received_events","type":"Organization","site_admin":false},"repo":{"id":36371959,"name":"avocado-vt","full_name":"avocado-framework/avocado-vt","owner":{"login":"avocado-framework","id":7245719,"avatar_url":"https://avatars.githubusercontent.com/u/7245719?v=3","gravatar_id":"","url":"https://api.github.com/users/avocado-framework","html_url":"https://github.com/avocado-framework","followers_url":"https://api.github.com/users/avocado-framework/followers","following_url":"https://api.github.com/users/avocado-framework/following{/other_user}","gists_url":"https://api.github.com/users/avocado-framework/gists{/gist_id}","starred_url":"https://api.github.com/users/avocado-framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avocado-framework/subscriptions","organizations_url":"https://api.github.com/users/avocado-framework/orgs","repos_url":"https://api.github.com/users/avocado-framework/repos","events_url":"https://api.github.com/users/avocado-framework/events{/privacy}","received_events_url":"https://api.github.com/users/avocado-framework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/avocado-framework/avocado-vt","description":"Avocado VT Plugin","fork":false,"url":"https://api.github.com/repos/avocado-framework/avocado-vt","forks_url":"https://api.github.com/repos/avocado-framework/avocado-vt/forks","keys_url":"https://api.github.com/repos/avocado-framework/avocado-vt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/avocado-framework/avocado-vt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/avocado-framework/avocado-vt/teams","hooks_url":"https://api.github.com/repos/avocado-framework/avocado-vt/hooks","issue_events_url":"https://api.github.com/repos/avocado-framework/avocado-vt/issues/events{/number}","events_url":"https://api.github.com/repos/avocado-framework/avocado-vt/events","assignees_url":"https://api.github.com/repos/avocado-framework/avocado-vt/assignees{/user}","branches_url":"https://api.github.com/repos/avocado-framework/avocado-vt/branches{/branch}","tags_url":"https://api.github.com/repos/avocado-framework/avocado-vt/tags","blobs_url":"https://api.github.com/repos/avocado-framework/avocado-vt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/avocado-framework/avocado-vt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/avocado-framework/avocado-vt/git/refs{/sha}","trees_url":"https://api.github.com/repos/avocado-framework/avocado-vt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/avocado-framework/avocado-vt/statuses/{sha}","languages_url":"https://api.github.com/repos/avocado-framework/avocado-vt/languages","stargazers_url":"https://api.github.com/repos/avocado-framework/avocado-vt/stargazers","contributors_url":"https://api.github.com/repos/avocado-framework/avocado-vt/contributors","subscribers_url":"https://api.github.com/repos/avocado-framework/avocado-vt/subscribers","subscription_url":"https://api.github.com/repos/avocado-framework/avocado-vt/subscription","commits_url":"https://api.github.com/repos/avocado-framework/avocado-vt/commits{/sha}","git_commits_url":"https://api.github.com/repos/avocado-framework/avocado-vt/git/commits{/sha}","comments_url":"https://api.github.com/repos/avocado-framework/avocado-vt/comments{/number}","issue_comment_url":"https://api.github.com/repos/avocado-framework/avocado-vt/issues/comments{/number}","contents_url":"https://api.github.com/repos/avocado-framework/avocado-vt/contents/{+path}","compare_url":"https://api.github.com/repos/avocado-framework/avocado-vt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/avocado-framework/avocado-vt/merges","archive_url":"https://api.github.com/repos/avocado-framework/avocado-vt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/avocado-framework/avocado-vt/downloads","issues_url":"https://api.github.com/repos/avocado-framework/avocado-vt/issues{/number}","pulls_url":"https://api.github.com/repos/avocado-framework/avocado-vt/pulls{/number}","milestones_url":"https://api.github.com/repos/avocado-framework/avocado-vt/milestones{/number}","notifications_url":"https://api.github.com/repos/avocado-framework/avocado-vt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/avocado-framework/avocado-vt/labels{/name}","releases_url":"https://api.github.com/repos/avocado-framework/avocado-vt/releases{/id}","deployments_url":"https://api.github.com/repos/avocado-framework/avocado-vt/deployments","created_at":"2015-05-27T14:22:13Z","updated_at":"2016-06-01T10:32:24Z","pushed_at":"2016-06-14T02:16:54Z","git_url":"git://github.com/avocado-framework/avocado-vt.git","ssh_url":"git@github.com:avocado-framework/avocado-vt.git","clone_url":"https://github.com/avocado-framework/avocado-vt.git","svn_url":"https://github.com/avocado-framework/avocado-vt","homepage":"http://avocado-vt.readthedocs.org/","size":19871,"stargazers_count":14,"watchers_count":14,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":52,"mirror_url":null,"open_issues_count":55,"forks":52,"open_issues":55,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/avocado-framework/avocado-vt/pulls/556"},"html":{"href":"https://github.com/avocado-framework/avocado-vt/pull/556"},"issue":{"href":"https://api.github.com/repos/avocado-framework/avocado-vt/issues/556"},"comments":{"href":"https://api.github.com/repos/avocado-framework/avocado-vt/issues/556/comments"},"review_comments":{"href":"https://api.github.com/repos/avocado-framework/avocado-vt/pulls/556/comments"},"review_comment":{"href":"https://api.github.com/repos/avocado-framework/avocado-vt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/avocado-framework/avocado-vt/pulls/556/commits"},"statuses":{"href":"https://api.github.com/repos/avocado-framework/avocado-vt/statuses/c09e0fdb33e26e98bcfe12cf85f931e1f39e26a7"}}}}
{"actor":{"display_login":"xutian"}}