{"action":"created","comment":{"url":"https://api.github.com/repos/autotest/tp-libvirt/pulls/comments/88845536","pull_request_review_id":9404451,"id":88845536,"diff_hunk":"@@ -143,12 +139,86 @@ def start_and_check():\n         Predict the error message when starting and try to start the guest.\n         \"\"\"\n         fail_patts = []\n-        if model == 'pci-bridge' and (index is None or int(index) == 0):\n+        if index and int(index) <= 0 and model == 'pci-bridge':\n             fail_patts.append(r\"PCI bridge index should be > 0\")\n         res = virsh.start(vm_name)\n         libvirt.check_result(res, expected_fails=fail_patts)\n         return not res.exit_status\n \n+    def prepare_qemu_pattern(elem):\n+        \"\"\"\n+        Read the required subelements from given element and combine\n+        the values for searching qemu command line.\n+\n+        :params elem: The element in guest controller XML\n+\n+        \"\"\"\n+        addr_elem = elem.find('./address')\n+        if addr_elem is None:\n+            raise exceptions.TestError(\"Can not find address element \"\n+                                       \"in guest XML.\")\n+        addr = Address.new_from_element(addr_elem).attrs\n+        bus = int(addr['bus'], 0)\n+        slot = int(addr['slot'], 0)\n+        func = int(addr['function'], 0)\n+        addr_str = '%02d:%02d.%1d' % (bus, slot, func)\n+\n+        target_elem = elem.find('./target')\n+        if target_elem is None:\n+            raise exceptions.TestError(\"Can not find target element \"\n+                                       \"in guest XML.\")\n+        chassisNR = target_elem.get('chassisNr')\n+\n+        alias_elem = elem.find('./alias')\n+        if alias_elem is None:\n+            raise exceptions.TestError(\"Can not find alias element \"\n+                                       \"in guest XML.\")\n+        name = alias_elem.get('name')\n+\n+        value = \"pci-bridge,chassis_nr=%s\" % chassisNR\n+        value = \"%s,id=%s,bus=pci.0,addr=%#x\" % (value, name, slot)\n+        tup = ('-device', value)\n+        search_qemu_cmd.append(tup)\n+\n+    def check_guest_xml():\n+        \"\"\"\n+        Check if the guest XML has the expected content.\n+        \"\"\"\n+        cur_vm_xml = VMXML.new_from_dumpxml(vm_name)\n+        logging.debug(cur_vm_xml)\n+        # Check the pci-root controller has index = 0\n+        if no_pci_controller == \"yes\":\n+            for elem in cur_vm_xml.xmltreefile.findall('/devices/controller'):","path":"libvirt/tests/src/controller/controller_functional.py","position":83,"original_position":83,"commit_id":"544296042516233c58cb843a162eec974137de6a","original_commit_id":"544296042516233c58cb843a162eec974137de6a","user":{"login":"will-Do","id":1916899,"avatar_url":"https://avatars.githubusercontent.com/u/1916899?v=3","gravatar_id":"","url":"https://api.github.com/users/will-Do","html_url":"https://github.com/will-Do","followers_url":"https://api.github.com/users/will-Do/followers","following_url":"https://api.github.com/users/will-Do/following{/other_user}","gists_url":"https://api.github.com/users/will-Do/gists{/gist_id}","starred_url":"https://api.github.com/users/will-Do/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/will-Do/subscriptions","organizations_url":"https://api.github.com/users/will-Do/orgs","repos_url":"https://api.github.com/users/will-Do/repos","events_url":"https://api.github.com/users/will-Do/events{/privacy}","received_events_url":"https://api.github.com/users/will-Do/received_events","type":"User","site_admin":false},"body":"We do have a controller XML module","created_at":"2016-11-21T08:16:03Z","updated_at":"2016-11-21T08:20:59Z","html_url":"https://github.com/autotest/tp-libvirt/pull/915#discussion_r88845536","pull_request_url":"https://api.github.com/repos/autotest/tp-libvirt/pulls/915","_links":{"self":{"href":"https://api.github.com/repos/autotest/tp-libvirt/pulls/comments/88845536"},"html":{"href":"https://github.com/autotest/tp-libvirt/pull/915#discussion_r88845536"},"pull_request":{"href":"https://api.github.com/repos/autotest/tp-libvirt/pulls/915"}}},"pull_request":{"url":"https://api.github.com/repos/autotest/tp-libvirt/pulls/915","id":93513024,"html_url":"https://github.com/autotest/tp-libvirt/pull/915","diff_url":"https://github.com/autotest/tp-libvirt/pull/915.diff","patch_url":"https://github.com/autotest/tp-libvirt/pull/915.patch","issue_url":"https://api.github.com/repos/autotest/tp-libvirt/issues/915","number":915,"state":"open","locked":false,"title":"controller_functional: Add two cases for pci-bridge","user":{"login":"dzhengfy","id":16040311,"avatar_url":"https://avatars.githubusercontent.com/u/16040311?v=3","gravatar_id":"","url":"https://api.github.com/users/dzhengfy","html_url":"https://github.com/dzhengfy","followers_url":"https://api.github.com/users/dzhengfy/followers","following_url":"https://api.github.com/users/dzhengfy/following{/other_user}","gists_url":"https://api.github.com/users/dzhengfy/gists{/gist_id}","starred_url":"https://api.github.com/users/dzhengfy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dzhengfy/subscriptions","organizations_url":"https://api.github.com/users/dzhengfy/orgs","repos_url":"https://api.github.com/users/dzhengfy/repos","events_url":"https://api.github.com/users/dzhengfy/events{/privacy}","received_events_url":"https://api.github.com/users/dzhengfy/received_events","type":"User","site_admin":false},"body":"Case 1: Controller 'pci-root' can be automatically added.\r\nCase 2: Multiple 'pci-bridge' controllers will be automatically added\r\nwhen the bus number is larger than 0. For example, 'bus=0x03' is\r\nspecified in disk, then 'pci-bridge' controller with index = 1,2,3\r\nwill be added.\r\n\r\nSigned-off-by: Dan Zheng <dzheng@redhat.com>","created_at":"2016-11-14T06:14:19Z","updated_at":"2016-11-21T08:20:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7826798e4bad08b2ccf38413439f803db69b8243","assignee":{"login":"will-Do","id":1916899,"avatar_url":"https://avatars.githubusercontent.com/u/1916899?v=3","gravatar_id":"","url":"https://api.github.com/users/will-Do","html_url":"https://github.com/will-Do","followers_url":"https://api.github.com/users/will-Do/followers","following_url":"https://api.github.com/users/will-Do/following{/other_user}","gists_url":"https://api.github.com/users/will-Do/gists{/gist_id}","starred_url":"https://api.github.com/users/will-Do/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/will-Do/subscriptions","organizations_url":"https://api.github.com/users/will-Do/orgs","repos_url":"https://api.github.com/users/will-Do/repos","events_url":"https://api.github.com/users/will-Do/events{/privacy}","received_events_url":"https://api.github.com/users/will-Do/received_events","type":"User","site_admin":false},"assignees":[{"login":"will-Do","id":1916899,"avatar_url":"https://avatars.githubusercontent.com/u/1916899?v=3","gravatar_id":"","url":"https://api.github.com/users/will-Do","html_url":"https://github.com/will-Do","followers_url":"https://api.github.com/users/will-Do/followers","following_url":"https://api.github.com/users/will-Do/following{/other_user}","gists_url":"https://api.github.com/users/will-Do/gists{/gist_id}","starred_url":"https://api.github.com/users/will-Do/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/will-Do/subscriptions","organizations_url":"https://api.github.com/users/will-Do/orgs","repos_url":"https://api.github.com/users/will-Do/repos","events_url":"https://api.github.com/users/will-Do/events{/privacy}","received_events_url":"https://api.github.com/users/will-Do/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/autotest/tp-libvirt/pulls/915/commits","review_comments_url":"https://api.github.com/repos/autotest/tp-libvirt/pulls/915/comments","review_comment_url":"https://api.github.com/repos/autotest/tp-libvirt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/autotest/tp-libvirt/issues/915/comments","statuses_url":"https://api.github.com/repos/autotest/tp-libvirt/statuses/544296042516233c58cb843a162eec974137de6a","head":{"label":"dzhengfy:add_pci_bridge_cases_1","ref":"add_pci_bridge_cases_1","sha":"544296042516233c58cb843a162eec974137de6a","user":{"login":"dzhengfy","id":16040311,"avatar_url":"https://avatars.githubusercontent.com/u/16040311?v=3","gravatar_id":"","url":"https://api.github.com/users/dzhengfy","html_url":"https://github.com/dzhengfy","followers_url":"https://api.github.com/users/dzhengfy/followers","following_url":"https://api.github.com/users/dzhengfy/following{/other_user}","gists_url":"https://api.github.com/users/dzhengfy/gists{/gist_id}","starred_url":"https://api.github.com/users/dzhengfy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dzhengfy/subscriptions","organizations_url":"https://api.github.com/users/dzhengfy/orgs","repos_url":"https://api.github.com/users/dzhengfy/repos","events_url":"https://api.github.com/users/dzhengfy/events{/privacy}","received_events_url":"https://api.github.com/users/dzhengfy/received_events","type":"User","site_admin":false},"repo":{"id":48014313,"name":"tp-libvirt","full_name":"dzhengfy/tp-libvirt","owner":{"login":"dzhengfy","id":16040311,"avatar_url":"https://avatars.githubusercontent.com/u/16040311?v=3","gravatar_id":"","url":"https://api.github.com/users/dzhengfy","html_url":"https://github.com/dzhengfy","followers_url":"https://api.github.com/users/dzhengfy/followers","following_url":"https://api.github.com/users/dzhengfy/following{/other_user}","gists_url":"https://api.github.com/users/dzhengfy/gists{/gist_id}","starred_url":"https://api.github.com/users/dzhengfy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dzhengfy/subscriptions","organizations_url":"https://api.github.com/users/dzhengfy/orgs","repos_url":"https://api.github.com/users/dzhengfy/repos","events_url":"https://api.github.com/users/dzhengfy/events{/privacy}","received_events_url":"https://api.github.com/users/dzhengfy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dzhengfy/tp-libvirt","description":"Test Provider for Libvirt and related virtualization backends","fork":true,"url":"https://api.github.com/repos/dzhengfy/tp-libvirt","forks_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/forks","keys_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/teams","hooks_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/hooks","issue_events_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/issues/events{/number}","events_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/events","assignees_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/assignees{/user}","branches_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/branches{/branch}","tags_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/tags","blobs_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/git/refs{/sha}","trees_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/statuses/{sha}","languages_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/languages","stargazers_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/stargazers","contributors_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/contributors","subscribers_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/subscribers","subscription_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/subscription","commits_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/commits{/sha}","git_commits_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/git/commits{/sha}","comments_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/comments{/number}","issue_comment_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/issues/comments{/number}","contents_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/contents/{+path}","compare_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/merges","archive_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/downloads","issues_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/issues{/number}","pulls_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/pulls{/number}","milestones_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/milestones{/number}","notifications_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/labels{/name}","releases_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/releases{/id}","deployments_url":"https://api.github.com/repos/dzhengfy/tp-libvirt/deployments","created_at":"2015-12-15T02:23:20Z","updated_at":"2016-01-20T07:22:03Z","pushed_at":"2016-11-17T06:40:44Z","git_url":"git://github.com/dzhengfy/tp-libvirt.git","ssh_url":"git@github.com:dzhengfy/tp-libvirt.git","clone_url":"https://github.com/dzhengfy/tp-libvirt.git","svn_url":"https://github.com/dzhengfy/tp-libvirt","homepage":null,"size":10855,"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":"1bfb9ac4b008c57cc26e76756b55f3ec342e0713","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":16180517,"name":"tp-libvirt","full_name":"autotest/tp-libvirt","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-libvirt","description":"Test Provider for Libvirt and related virtualization backends","fork":false,"url":"https://api.github.com/repos/autotest/tp-libvirt","forks_url":"https://api.github.com/repos/autotest/tp-libvirt/forks","keys_url":"https://api.github.com/repos/autotest/tp-libvirt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/autotest/tp-libvirt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/autotest/tp-libvirt/teams","hooks_url":"https://api.github.com/repos/autotest/tp-libvirt/hooks","issue_events_url":"https://api.github.com/repos/autotest/tp-libvirt/issues/events{/number}","events_url":"https://api.github.com/repos/autotest/tp-libvirt/events","assignees_url":"https://api.github.com/repos/autotest/tp-libvirt/assignees{/user}","branches_url":"https://api.github.com/repos/autotest/tp-libvirt/branches{/branch}","tags_url":"https://api.github.com/repos/autotest/tp-libvirt/tags","blobs_url":"https://api.github.com/repos/autotest/tp-libvirt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/autotest/tp-libvirt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/autotest/tp-libvirt/git/refs{/sha}","trees_url":"https://api.github.com/repos/autotest/tp-libvirt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/autotest/tp-libvirt/statuses/{sha}","languages_url":"https://api.github.com/repos/autotest/tp-libvirt/languages","stargazers_url":"https://api.github.com/repos/autotest/tp-libvirt/stargazers","contributors_url":"https://api.github.com/repos/autotest/tp-libvirt/contributors","subscribers_url":"https://api.github.com/repos/autotest/tp-libvirt/subscribers","subscription_url":"https://api.github.com/repos/autotest/tp-libvirt/subscription","commits_url":"https://api.github.com/repos/autotest/tp-libvirt/commits{/sha}","git_commits_url":"https://api.github.com/repos/autotest/tp-libvirt/git/commits{/sha}","comments_url":"https://api.github.com/repos/autotest/tp-libvirt/comments{/number}","issue_comment_url":"https://api.github.com/repos/autotest/tp-libvirt/issues/comments{/number}","contents_url":"https://api.github.com/repos/autotest/tp-libvirt/contents/{+path}","compare_url":"https://api.github.com/repos/autotest/tp-libvirt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/autotest/tp-libvirt/merges","archive_url":"https://api.github.com/repos/autotest/tp-libvirt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/autotest/tp-libvirt/downloads","issues_url":"https://api.github.com/repos/autotest/tp-libvirt/issues{/number}","pulls_url":"https://api.github.com/repos/autotest/tp-libvirt/pulls{/number}","milestones_url":"https://api.github.com/repos/autotest/tp-libvirt/milestones{/number}","notifications_url":"https://api.github.com/repos/autotest/tp-libvirt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/autotest/tp-libvirt/labels{/name}","releases_url":"https://api.github.com/repos/autotest/tp-libvirt/releases{/id}","deployments_url":"https://api.github.com/repos/autotest/tp-libvirt/deployments","created_at":"2014-01-23T17:58:18Z","updated_at":"2016-10-25T05:46:02Z","pushed_at":"2016-11-21T08:05:07Z","git_url":"git://github.com/autotest/tp-libvirt.git","ssh_url":"git@github.com:autotest/tp-libvirt.git","clone_url":"https://github.com/autotest/tp-libvirt.git","svn_url":"https://github.com/autotest/tp-libvirt","homepage":null,"size":11670,"stargazers_count":11,"watchers_count":11,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":77,"mirror_url":null,"open_issues_count":32,"forks":77,"open_issues":32,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/autotest/tp-libvirt/pulls/915"},"html":{"href":"https://github.com/autotest/tp-libvirt/pull/915"},"issue":{"href":"https://api.github.com/repos/autotest/tp-libvirt/issues/915"},"comments":{"href":"https://api.github.com/repos/autotest/tp-libvirt/issues/915/comments"},"review_comments":{"href":"https://api.github.com/repos/autotest/tp-libvirt/pulls/915/comments"},"review_comment":{"href":"https://api.github.com/repos/autotest/tp-libvirt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/autotest/tp-libvirt/pulls/915/commits"},"statuses":{"href":"https://api.github.com/repos/autotest/tp-libvirt/statuses/544296042516233c58cb843a162eec974137de6a"}}}}
{"actor":{"display_login":"will-Do"}}