Bug 1041276

Summary: [RFE][nova]: Support passthrough of USB devices of host
Product: Red Hat OpenStack Reporter: RHOS Integration <rhos-integ>
Component: RFEsAssignee: RHOS Maint <rhos-maint>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: markmc, yeylon
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://blueprints.launchpad.net/nova/+spec/host-usb-passthrough
Whiteboard: upstream_milestone_none upstream_status_unknown upstream_definition_obsolete
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-19 17:02:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description RHOS Integration 2013-12-12 14:14:10 UTC
Cloned from launchpad blueprint https://blueprints.launchpad.net/nova/+spec/host-usb-passthrough.

Description:

Add support for usb passthrough http://wiki.libvirt.org/page/QEMUSwitchToLibvirt#-usbdevice_2

This feature may be specific for some private cloud use cases only. So an option to disable or disable it by default may be appropriate?

Example workflow in horizon:
1.  User clicks on the action Attach USB device
     a. Nova executes lsusb and retuns list of available pci devices with names on the host of the instance
     b. Horizon shows the names of the usb devices such as Sandisk Cruzer
2. The user chooses to attach the Sandisk Cruzer to instance-x
     a. Nova get the bus and device number and use libvirt to attach the device using the libvirt api

I think there should be a new table called host_usb_devices which stores the name, bus, device, instance_uuid, state

Where state would also track the progress, possible states: attaching, attached, available, failed

Things that should be considered:
- What if the usb device gets unplugged rebooting the instance wont be possible because it cant find the attached device. So when rebooting we need to also check if there are any usb devices attached and if they still exist. Happened to me once was unable to boot the instance if the usb was removed but still attached to the instance.
- Live-migration or move to another host
- If the instance is powered off and / or suspended we need to use the following command: virsh detach-device instance-000000ca usb-device.xml --config because you can't detach from an inactive domain, maybe the python libvirt api has a flag for it
- Device can only be used by single instance
- What about other hypervisor support?

Specification URL (additional information):

None