Comment 24 for bug 1552241

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

root@ubuntu:~#
root@ubuntu:~# virsh define testguest.xml
Domain testguest defined from testguest.xml

root@ubuntu:~# virsh start testguest
Domain testguest started

root@ubuntu:~# cat <<EOF >usb.xml
> <hostdev mode='subsystem' type='usb' managed='yes'>
> <source>
> <vendor id='0x046d'/>
> <product id='0x0825'/>
> </source>
> </hostdev>
> EOF

root@ubuntu:~# virsh attach-device testguest usb.xml
error: Failed to attach device from usb.xml
error: internal error: unable to execute QEMU command 'device_add': failed to find host usb device 2:10

Denies while USB was initialized the first time:
[ 1046.984694] audit: type=1400 audit(1508926280.712:48): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="libvirt-deadbeef-dead-beef-dead-beefdeadbeef" pid=6668 comm="apparmor_parser"
[ 1046.987757] audit: type=1400 audit(1508926280.715:49): apparmor="DENIED" operation="open" profile="libvirt-deadbeef-dead-beef-dead-beefdeadbeef" name="/run/udev/data/c189:133" pid=6638 comm="qemu-system-x86" requested_mask="r" denied_mask="r" fsuid=64055 ouid=0
[ 1046.987831] audit: type=1400 audit(1508926280.715:50): apparmor="DENIED" operation="open" profile="libvirt-deadbeef-dead-beef-dead-beefdeadbeef" name="/run/udev/data/c189:256" pid=6638 comm="qemu-system-x86" requested_mask="r" denied_mask="r" fsuid=64055 ouid=0
[ 1046.988143] audit: type=1400 audit(1508926280.715:55): apparmor="DENIED" operation="open" profile="libvirt-deadbeef-dead-beef-dead-beefdeadbeef" name="/run/udev/data/c189:129" pid=6638 comm="qemu-system-x86" requested_mask="r" denied_mask="r" fsuid=64055 ouid=0
[ 1046.988263] audit: type=1400 audit(1508926280.715:57): apparmor="DENIED" operation="open" profile="libvirt-deadbeef-dead-beef-dead-beefdeadbeef" name="/run/udev/data/c189:0" pid=6638 comm="qemu-system-x86" requested_mask="r" denied_mask="r" fsuid=64055 ouid=0

Due to the design of qemu (no rescan later) we need to restart the qemu process after the upgrade.

# Upgrade to Proposed (in other window)
# then start guest again and then attach the device (now working)

virsh attach-device testguest usb.xml

=> Verified

Note: since you likely came here for having issues with USB passthrough. While working on this I found related issues, please check the following bugs to be sure you not just have to add a config or so:
- bug 1727311
- bug 1727313