{"action":"created","comment":{"url":"https://api.github.com/repos/autotest/tp-libvirt/pulls/comments/90390603","pull_request_review_id":10908436,"id":90390603,"diff_hunk":"@@ -36,59 +34,58 @@ def compare_capabilities_xml(source):\n         logging.debug(\"Host arch (capabilities_xml): %s\", xml_arch)\n         exp_arch = process.run(\"arch\", shell=True).stdout.strip()\n         if cmp(xml_arch, exp_arch) != 0:\n-            raise error.TestFail(\"The host arch in capabilities_xml is expected\"\n-                                 \" to be %s, but get %s\" % (exp_arch, xml_arch))\n+            raise error.TestFail(\"The host arch in capabilities_xml is \"\n+                                 \"expected to be %s, but get %s\" %\n+                                 (exp_arch, xml_arch))\n \n         # Check the host cpu count.\n         xml_cpu_count = cap_xml.cpu_count\n         logging.debug(\"Host cpus count (capabilities_xml): %s\", xml_cpu_count)\n         cmd = \"grep processor /proc/cpuinfo | wc -l\"\n         exp_cpu_count = int(process.run(cmd, shell=True).stdout.strip())\n         if xml_cpu_count != exp_cpu_count:\n-            raise error.TestFail(\"Host cpus count is expected to be %s, but get \"\n-                                 \"%s\" % (exp_cpu_count, xml_cpu_count))\n+            raise error.TestFail(\"Host cpus count is expected to be %s, \"\n+                                 \"but get %s\" %\n+                                 (exp_cpu_count, xml_cpu_count))\n \n         # Check the arch of guest supported.\n         guest_capa = cap_xml.get_guest_capabilities()\n         logging.debug(guest_capa)\n-        try:\n-            img = utils_path.find_command(\"qemu-kvm\")\n-        except utils_path.CmdNotFoundError:\n-            try:\n-                # For Ubuntu /usr/bin/kvm is available instead of qemu-kvm\n-                img = utils_path.find_command(\"kvm\")\n-            except utils_path.CmdNotFoundError:\n-                raise error.TestNAError(\"Cannot find {qemu-}kvm binary in host\")\n-        if re.search(\"ppc\", process.run(\"arch\", shell=True).stdout):\n-            cmd = img + \" --cpu ? | grep ppc\"\n-        else:\n-            cmd = img + \" --cpu ? | grep qemu\"\n-        cmd_result = process.run(cmd, shell=True)\n-        for guest in cap_xml.xmltreefile.findall('guest'):\n-            guest_wordsize = guest.find('arch').find('wordsize').text\n-            logging.debug(\"Arch of guest supported (capabilities_xml):%s\",\n-                          guest_wordsize)\n-            if not re.search(guest_wordsize, cmd_result.stdout.strip()):\n-                raise error.TestFail(\"The capabilities_xml gives an extra arch \"\n-                                     \"of guest to support!\")\n-\n-        # Check the type of hypervisor.\n-        first_guest = cap_xml.xmltreefile.findall('guest')[0]\n-        first_domain = first_guest.find('arch').findall('domain')[0]\n-        guest_domain_type = first_domain.get('type')\n-        logging.debug(\"Hypervisor (capabilities_xml):%s\", guest_domain_type)\n-        cmd_result = process.run(\"virsh uri\", shell=True)\n-        if not re.search(guest_domain_type, cmd_result.stdout.strip()):\n-            raise error.TestFail(\"The capabilities_xml gives an different \"\n-                                 \"hypervisor\")\n+\n+        # libvirt track wordsize in hardcode struct virArchData\n+        wordsize = {}\n+        wordsize['64'] = ['alpha', 'aarch64', 'ia64', 'mips64', 'mips64el',\n+                          'parisc64', 'ppc64', 'ppc64le', 's390x', 'sh4eb',\n+                          'sparc64', 'x86_64']\n+        wordsize['32'] = ['armv6l', 'armv7l', 'armv7b', 'cris', 'i686', 'lm32',\n+                          'm68k', 'microblaze', 'microblazeel', 'mips',\n+                          'mipsel', 'openrisc', 'parisc', 'ppc', 'ppcle',\n+                          'ppcemb', 's390', 'sh4', 'sparc', 'unicore32',\n+                          'xtensa', 'xtensaeb']\n+        host_arch = process.run(\"arch\", shell=True).stdout\n+        uri_type = process.run(\"virsh uri\", shell=True).stdout.split(':')[0]\n+        domain_type = \"domain_\" + uri_type\n+        for arch_dict in guest_capa.values():\n+            for arch, val_dict in arch_dict.items():\n+                # Check wordsize\n+                if arch not in wordsize[val_dict['wordsize']]:\n+                    raise error.TestFail(\"'%s' wordsize '%s' in \"\n+                                         \"capabilities_xml not expected\" %\n+                                         (arch, val_dict['wordsize']))\n+                # Check the type of hypervisor\n+                if arch == host_arch:","path":"libvirt/tests/src/virsh_cmd/host/virsh_capabilities.py","position":null,"original_position":97,"commit_id":"5ef792000300b50ff898d4d43376e5e81773af47","original_commit_id":"016f50246d6a4b9bf841bdaea406cabef9f24301","user":{"login":"waynesun09","id":1912684,"avatar_url":"https://avatars.githubusercontent.com/u/1912684?v=3","gravatar_id":"","url":"https://api.github.com/users/waynesun09","html_url":"https://github.com/waynesun09","followers_url":"https://api.github.com/users/waynesun09/followers","following_url":"https://api.github.com/users/waynesun09/following{/other_user}","gists_url":"https://api.github.com/users/waynesun09/gists{/gist_id}","starred_url":"https://api.github.com/users/waynesun09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waynesun09/subscriptions","organizations_url":"https://api.github.com/users/waynesun09/orgs","repos_url":"https://api.github.com/users/waynesun09/repos","events_url":"https://api.github.com/users/waynesun09/events{/privacy}","received_events_url":"https://api.github.com/users/waynesun09/received_events","type":"User","site_admin":false},"body":"Updated to check under all archs","created_at":"2016-12-01T06:37:56Z","updated_at":"2016-12-01T06:37:56Z","html_url":"https://github.com/autotest/tp-libvirt/pull/935#discussion_r90390603","pull_request_url":"https://api.github.com/repos/autotest/tp-libvirt/pulls/935","_links":{"self":{"href":"https://api.github.com/repos/autotest/tp-libvirt/pulls/comments/90390603"},"html":{"href":"https://github.com/autotest/tp-libvirt/pull/935#discussion_r90390603"},"pull_request":{"href":"https://api.github.com/repos/autotest/tp-libvirt/pulls/935"}}},"pull_request":{"url":"https://api.github.com/repos/autotest/tp-libvirt/pulls/935","id":95852601,"html_url":"https://github.com/autotest/tp-libvirt/pull/935","diff_url":"https://github.com/autotest/tp-libvirt/pull/935.diff","patch_url":"https://github.com/autotest/tp-libvirt/pull/935.patch","issue_url":"https://api.github.com/repos/autotest/tp-libvirt/issues/935","number":935,"state":"open","locked":false,"title":"capabilities: Fix wordsize and default hypervisor check","user":{"login":"waynesun09","id":1912684,"avatar_url":"https://avatars.githubusercontent.com/u/1912684?v=3","gravatar_id":"","url":"https://api.github.com/users/waynesun09","html_url":"https://github.com/waynesun09","followers_url":"https://api.github.com/users/waynesun09/followers","following_url":"https://api.github.com/users/waynesun09/following{/other_user}","gists_url":"https://api.github.com/users/waynesun09/gists{/gist_id}","starred_url":"https://api.github.com/users/waynesun09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waynesun09/subscriptions","organizations_url":"https://api.github.com/users/waynesun09/orgs","repos_url":"https://api.github.com/users/waynesun09/repos","events_url":"https://api.github.com/users/waynesun09/events{/privacy}","received_events_url":"https://api.github.com/users/waynesun09/received_events","type":"User","site_admin":false},"body":"Update both check use guest capabilities dict, and check wordsize\r\nfrom dict same as libvirt struct.\r\n\r\nSigned-off-by: Wayne Sun <gsun@redhat.com>","created_at":"2016-11-30T09:11:25Z","updated_at":"2016-12-01T06:37:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a39eda7c8363b74deb9367ec24e398804e2f7d34","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/autotest/tp-libvirt/pulls/935/commits","review_comments_url":"https://api.github.com/repos/autotest/tp-libvirt/pulls/935/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/935/comments","statuses_url":"https://api.github.com/repos/autotest/tp-libvirt/statuses/5ef792000300b50ff898d4d43376e5e81773af47","head":{"label":"waynesun09:capabilities","ref":"capabilities","sha":"5ef792000300b50ff898d4d43376e5e81773af47","user":{"login":"waynesun09","id":1912684,"avatar_url":"https://avatars.githubusercontent.com/u/1912684?v=3","gravatar_id":"","url":"https://api.github.com/users/waynesun09","html_url":"https://github.com/waynesun09","followers_url":"https://api.github.com/users/waynesun09/followers","following_url":"https://api.github.com/users/waynesun09/following{/other_user}","gists_url":"https://api.github.com/users/waynesun09/gists{/gist_id}","starred_url":"https://api.github.com/users/waynesun09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waynesun09/subscriptions","organizations_url":"https://api.github.com/users/waynesun09/orgs","repos_url":"https://api.github.com/users/waynesun09/repos","events_url":"https://api.github.com/users/waynesun09/events{/privacy}","received_events_url":"https://api.github.com/users/waynesun09/received_events","type":"User","site_admin":false},"repo":{"id":16305119,"name":"tp-libvirt","full_name":"waynesun09/tp-libvirt","owner":{"login":"waynesun09","id":1912684,"avatar_url":"https://avatars.githubusercontent.com/u/1912684?v=3","gravatar_id":"","url":"https://api.github.com/users/waynesun09","html_url":"https://github.com/waynesun09","followers_url":"https://api.github.com/users/waynesun09/followers","following_url":"https://api.github.com/users/waynesun09/following{/other_user}","gists_url":"https://api.github.com/users/waynesun09/gists{/gist_id}","starred_url":"https://api.github.com/users/waynesun09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waynesun09/subscriptions","organizations_url":"https://api.github.com/users/waynesun09/orgs","repos_url":"https://api.github.com/users/waynesun09/repos","events_url":"https://api.github.com/users/waynesun09/events{/privacy}","received_events_url":"https://api.github.com/users/waynesun09/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/waynesun09/tp-libvirt","description":"Test Provider for Libvirt and related virtualization backends","fork":true,"url":"https://api.github.com/repos/waynesun09/tp-libvirt","forks_url":"https://api.github.com/repos/waynesun09/tp-libvirt/forks","keys_url":"https://api.github.com/repos/waynesun09/tp-libvirt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/waynesun09/tp-libvirt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/waynesun09/tp-libvirt/teams","hooks_url":"https://api.github.com/repos/waynesun09/tp-libvirt/hooks","issue_events_url":"https://api.github.com/repos/waynesun09/tp-libvirt/issues/events{/number}","events_url":"https://api.github.com/repos/waynesun09/tp-libvirt/events","assignees_url":"https://api.github.com/repos/waynesun09/tp-libvirt/assignees{/user}","branches_url":"https://api.github.com/repos/waynesun09/tp-libvirt/branches{/branch}","tags_url":"https://api.github.com/repos/waynesun09/tp-libvirt/tags","blobs_url":"https://api.github.com/repos/waynesun09/tp-libvirt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/waynesun09/tp-libvirt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/waynesun09/tp-libvirt/git/refs{/sha}","trees_url":"https://api.github.com/repos/waynesun09/tp-libvirt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/waynesun09/tp-libvirt/statuses/{sha}","languages_url":"https://api.github.com/repos/waynesun09/tp-libvirt/languages","stargazers_url":"https://api.github.com/repos/waynesun09/tp-libvirt/stargazers","contributors_url":"https://api.github.com/repos/waynesun09/tp-libvirt/contributors","subscribers_url":"https://api.github.com/repos/waynesun09/tp-libvirt/subscribers","subscription_url":"https://api.github.com/repos/waynesun09/tp-libvirt/subscription","commits_url":"https://api.github.com/repos/waynesun09/tp-libvirt/commits{/sha}","git_commits_url":"https://api.github.com/repos/waynesun09/tp-libvirt/git/commits{/sha}","comments_url":"https://api.github.com/repos/waynesun09/tp-libvirt/comments{/number}","issue_comment_url":"https://api.github.com/repos/waynesun09/tp-libvirt/issues/comments{/number}","contents_url":"https://api.github.com/repos/waynesun09/tp-libvirt/contents/{+path}","compare_url":"https://api.github.com/repos/waynesun09/tp-libvirt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/waynesun09/tp-libvirt/merges","archive_url":"https://api.github.com/repos/waynesun09/tp-libvirt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/waynesun09/tp-libvirt/downloads","issues_url":"https://api.github.com/repos/waynesun09/tp-libvirt/issues{/number}","pulls_url":"https://api.github.com/repos/waynesun09/tp-libvirt/pulls{/number}","milestones_url":"https://api.github.com/repos/waynesun09/tp-libvirt/milestones{/number}","notifications_url":"https://api.github.com/repos/waynesun09/tp-libvirt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/waynesun09/tp-libvirt/labels{/name}","releases_url":"https://api.github.com/repos/waynesun09/tp-libvirt/releases{/id}","deployments_url":"https://api.github.com/repos/waynesun09/tp-libvirt/deployments","created_at":"2014-01-28T07:33:44Z","updated_at":"2016-04-12T03:54:35Z","pushed_at":"2016-12-01T06:36:43Z","git_url":"git://github.com/waynesun09/tp-libvirt.git","ssh_url":"git@github.com:waynesun09/tp-libvirt.git","clone_url":"https://github.com/waynesun09/tp-libvirt.git","svn_url":"https://github.com/waynesun09/tp-libvirt","homepage":null,"size":10883,"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":"autotest:master","ref":"master","sha":"83fb48539007a826028c8b4b201ba5bd24b139b4","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-12-01T06:36:43Z","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":11752,"stargazers_count":11,"watchers_count":11,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":78,"mirror_url":null,"open_issues_count":37,"forks":78,"open_issues":37,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/autotest/tp-libvirt/pulls/935"},"html":{"href":"https://github.com/autotest/tp-libvirt/pull/935"},"issue":{"href":"https://api.github.com/repos/autotest/tp-libvirt/issues/935"},"comments":{"href":"https://api.github.com/repos/autotest/tp-libvirt/issues/935/comments"},"review_comments":{"href":"https://api.github.com/repos/autotest/tp-libvirt/pulls/935/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/935/commits"},"statuses":{"href":"https://api.github.com/repos/autotest/tp-libvirt/statuses/5ef792000300b50ff898d4d43376e5e81773af47"}}}}
{"actor":{"display_login":"waynesun09"}}