{"action":"created","issue":{"url":"https://api.github.com/repos/avocado-framework/avocado-vt/issues/120","labels_url":"https://api.github.com/repos/avocado-framework/avocado-vt/issues/120/labels{/name}","comments_url":"https://api.github.com/repos/avocado-framework/avocado-vt/issues/120/comments","events_url":"https://api.github.com/repos/avocado-framework/avocado-vt/issues/120/events","html_url":"https://github.com/avocado-framework/avocado-vt/pull/120","id":106272052,"number":120,"title":"USB type device passthrough using add_hostdev","user":{"login":"bssrikanth","id":11852063,"avatar_url":"https://avatars.githubusercontent.com/u/11852063?v=3","gravatar_id":"","url":"https://api.github.com/users/bssrikanth","html_url":"https://github.com/bssrikanth","followers_url":"https://api.github.com/users/bssrikanth/followers","following_url":"https://api.github.com/users/bssrikanth/following{/other_user}","gists_url":"https://api.github.com/users/bssrikanth/gists{/gist_id}","starred_url":"https://api.github.com/users/bssrikanth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bssrikanth/subscriptions","organizations_url":"https://api.github.com/users/bssrikanth/orgs","repos_url":"https://api.github.com/users/bssrikanth/repos","events_url":"https://api.github.com/users/bssrikanth/events{/privacy}","received_events_url":"https://api.github.com/users/bssrikanth/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-14T05:15:17Z","updated_at":"2015-09-24T04:09:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/avocado-framework/avocado-vt/pulls/120","html_url":"https://github.com/avocado-framework/avocado-vt/pull/120","diff_url":"https://github.com/avocado-framework/avocado-vt/pull/120.diff","patch_url":"https://github.com/avocado-framework/avocado-vt/pull/120.patch"},"body":"Currently hostdev addition supported adding only pci type device for\r\npassthrough. This commit has added capability to within framework to \r\ngenerate a hostdev xml section for USB device passthrough.\r\nGuest VM xml add hostdev will now be able accept USB specific parameters\r\nand add respective xml clause to guest VM accordingly.\r\n\r\nSigned-off-by: Srikanth Aithal <sraithal@linux.vnet.ibm.com>"},"comment":{"url":"https://api.github.com/repos/avocado-framework/avocado-vt/issues/comments/142805468","html_url":"https://github.com/avocado-framework/avocado-vt/pull/120#issuecomment-142805468","issue_url":"https://api.github.com/repos/avocado-framework/avocado-vt/issues/120","id":142805468,"user":{"login":"bssrikanth","id":11852063,"avatar_url":"https://avatars.githubusercontent.com/u/11852063?v=3","gravatar_id":"","url":"https://api.github.com/users/bssrikanth","html_url":"https://github.com/bssrikanth","followers_url":"https://api.github.com/users/bssrikanth/followers","following_url":"https://api.github.com/users/bssrikanth/following{/other_user}","gists_url":"https://api.github.com/users/bssrikanth/gists{/gist_id}","starred_url":"https://api.github.com/users/bssrikanth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bssrikanth/subscriptions","organizations_url":"https://api.github.com/users/bssrikanth/orgs","repos_url":"https://api.github.com/users/bssrikanth/repos","events_url":"https://api.github.com/users/bssrikanth/events{/privacy}","received_events_url":"https://api.github.com/users/bssrikanth/received_events","type":"User","site_admin":false},"created_at":"2015-09-24T04:09:29Z","updated_at":"2015-09-24T04:09:29Z","body":"@will-Do , thanks much for your guidance.  I have re-written the code considering your suggestion. \r\nPlease have a look. I had to use accessors.XMLElementNest for product and vendor id clauses to get that embedded within <source> tag.\r\n```\r\n<hostdev managed=\"yes\" mode=\"subsystem\" type=\"usb\">\r\n    <source>\r\n    \t<address bus=\"0x001\" device=\"0x004\" />\r\n    \t<vendor id=\"0x04f2\" />\r\n    \t<product id=\"0xb221\" />\r\n    </source>\r\n</hostdev>\r\n```\r\nResult:\r\n\r\n09:00:00 test             L0153 INFO | START type_specific.io-github-autotest-libvirt.usb_passthrough.device\r\n09:00:00 vt               L0376 INFO | Avocado-VT '0.28.0 (RPM install)'\r\n09:00:00 vt               L0378 INFO | Starting test 0\r\n09:00:00 vt               L0379 DEBUG| Test parameters:\r\n09:00:00 vt               L0383 DEBUG|     _name_map_file = {'subtests.cfg': '(subtest=type_specific).(subtest=io-github-autotest-libvirt).(subtest=usb_passthrough).device', 'drivers.cfg': 'qemu', 'guest-hw.cfg': 'bridge.default_bios.no_virtio_rng.(image_backend=filesystem).no_9p_export.smallpages.no_pci_assignable.qcow2.virtio_blk.smp2.virtio_net', 'guest-os.cfg': 'Linux.JeOS.21.x86_64', 'machines.cfg': 'i440fx', 'tests.cfg': 'libvirt_quick'}\r\n09:00:00 vt               L0383 DEBUG|     _short_name_map_file = {'subtests.cfg': 'type_specific.io-github-autotest-libvirt.usb_passthrough.device', 'drivers.cfg': 'qemu', 'guest-hw.cfg': 'bridge.default_bios.no_virtio_rng.filesystem.no_9p_export.smallpages.no_pci_assignable.qcow2.virtio_blk.smp2.virtio_net', 'guest-os.cfg': 'Linux.JeOS.21.x86_64', 'machines.cfg': 'i440fx', 'tests.cfg': 'libvirt_quick'}\r\n..\r\n..\r\n09:00:01 virt_vm          L0686 DEBUG| Found/Verified IP 192.168.122.126 for VM avocado-vt-vm1 NIC 0\r\n09:00:01 remote           L0248 DEBUG| Login command: 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password -p 22 root@192.168.122.126'\r\n09:00:11 virt_vm          L1022 DEBUG| Login timeout expired    (output: '')\r\n09:00:19 virt_vm          L0686 DEBUG| Found/Verified IP 192.168.122.126 for VM avocado-vt-vm1 NIC 0\r\n09:00:19 remote           L0248 DEBUG| Login command: 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password -p 22 root@192.168.122.126'\r\n09:00:20 client           L1042 DEBUG| Sending command: lsusb\r\n09:00:20 client           L1042 DEBUG| Sending command: echo $?\r\n09:00:21 client           L1042 DEBUG| Sending command: lsusb|awk '{print $6}'\r\n09:00:21 usb_passthrough  L0086 INFO | Passthrough will occur for following USB devices : ['Bus 001 Device 004: ID 04f2:b221 Chicony Electronics Co., Ltd integrated camera']\r\n09:00:21 usb_passthrough  L0091 INFO | Passthrough started for usb device Bus 001 Device 004: ID 04f2:b221 Chicony Electronics Co., Ltd integrated camera\r\n09:00:21 usb_passthrough  L0096 INFO | USB devices within guest before passthrough: 0627:0001\r\n1d6b:0002\r\n1d6b:0001\r\n1d6b:0001\r\n1d6b:0001\r\n09:00:21 usb_passthrough  L0109 DEBUG|\r\n```\r\n<?xml version='1.0' encoding='UTF-8'?>\r\n<domain type=\"kvm\">\r\n  <name>avocado-vt-vm1</name>\r\n  <uuid>d25278b4-324c-42be-b31a-6a8fa59c31c6</uuid>\r\n  <memory unit=\"KiB\">1048576</memory>\r\n  <currentMemory unit=\"KiB\">1048576</currentMemory>\r\n  <vcpu placement=\"static\">2</vcpu>\r\n..\r\n..\r\n  <memballoon model=\"virtio\">\r\n      <address bus=\"0x00\" domain=\"0x0000\" function=\"0x0\" slot=\"0x07\" type=\"pci\" />\r\n    </memballoon><hostdev managed=\"yes\" mode=\"subsystem\" type=\"usb\"><source><address bus=\"0x001\" device=\"0x004\" /><vendor id=\"0x04f2\" /><product id=\"0xb221\" /></source></hostdev></devices></domain>\r\n09:00:21 virsh            L1326 DEBUG| Undefine VM avocado-vt-vm1\r\n09:00:21 virsh            L1310 DEBUG| Define VM from /tmp/xml_utils_temp_B61pQ9.xml\r\n09:00:21 libvirt_vm       L1936 DEBUG| Starting vm 'avocado-vt-vm1'\r\n09:00:22 utils_misc       L0623 DEBUG| waiting for domain avocado-vt-vm1 to start (0.000017 secs)\r\n09:00:22 virt_vm          L1012 DEBUG| Attempting to log into 'avocado-vt-vm1' (timeout 360s)\r\n09:00:22 virt_vm          L0686 DEBUG| Found/Verified IP 192.168.122.126 for VM avocado-vt-vm1 NIC 0\r\n09:00:22 remote           L0248 DEBUG| Login command: 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password -p 22 root@192.168.122.126'\r\n09:00:30 client           L1042 DEBUG| Sending command: lsusb\r\n09:00:30 client           L1042 DEBUG| Sending command: echo $?\r\n09:00:31 client           L1042 DEBUG| Sending command: lsusb|awk '{print $6}'\r\n09:00:31 usb_passthrough  L0116 INFO | USB devices within guest after passthrough: 04f2:b221\r\n0627:0001\r\n1d6b:0002\r\n1d6b:0001\r\n1d6b:0001\r\n1d6b:0001\r\n\r\n09:00:31 usb_passthrough  L0122 INFO | Passthrough passed for USB device Bus 001 Device 004: ID 04f2:b221 Chicony Electronics Co., Ltd integrated camera\r\n09:00:32 virsh            L1326 DEBUG| Undefine VM avocado-vt-vm1\r\n```"}}