Jump to: navigation, search

Difference between revisions of "Nova/proposal about usb passthrough"

(Consideration about usb-passthrough and hot-plug)
(Use case)
Line 14: Line 14:
  
 
2. Popular usb device are supporting usb 2.0 or usb 3.0 standard, so our cloud management software should guarantee the transfer speed of usb device.
 
2. Popular usb device are supporting usb 2.0 or usb 3.0 standard, so our cloud management software should guarantee the transfer speed of usb device.
 +
 +
=== Test case ===
 +
I have tested some cases of creating vm with different type and number usb controller and usb device.<br/>
 +
I got the following result:<br/>
 +
(1)Usb controllers have a maximum port restriction. Uhci controller supports a maxmum of 2 ports while ehci controller supports 6.<br/>
 +
(2)If creating vm without usb controller, qemu will default create a piix3-usb-uhci controller but not creating the other type's.<br/>
 +
(3)If creating vm with usb device but no usb controller, the usb device will default be attached to the default uhci controller, but speed may mismatch.<br/>
 +
(4)There are two ways to support more usb devices. 1. Adding cascaded hubs and attaching usb devices to them. 2.Creating more controllers and connect usb devices to different ones.<br/>
 +
(5)If attaching usb-tablet to controller, the vm crashed. Qemu thrown a error(why?)<br/>
 +
(5)When creating vm with a pair of usb hub and ehci controller, the vm crashed. Qemu thrown a error(why?)<br/>
  
 
=== Consideration about usb controller ===
 
=== Consideration about usb controller ===

Revision as of 02:04, 7 March 2014

USB device and USB controller features

Background

Currently, nova has supported function of pci-passthrough, but hasn't supported usb-passthrough. There were a bp about it in https://blueprints.launchpad.net/nova/+spec/host-usb-passthrough but hasn't progress by now.

As I know, some telecom and enterprise customers have desired for usb-passthrough especially in private cloud. So I think maybe it's a good choice to provide this function in openstack.

Use case

Our customers have the following requirement:

1. There are some erp softwares deployed in virtual machines that need usb-key for authentication. Customers will first insert usb-key to host, then use the cloud management software to attach usb-key to vm, the last guest os will discovery usb-key and we can use it.

2. Popular usb device are supporting usb 2.0 or usb 3.0 standard, so our cloud management software should guarantee the transfer speed of usb device.

Test case

I have tested some cases of creating vm with different type and number usb controller and usb device.
I got the following result:
(1)Usb controllers have a maximum port restriction. Uhci controller supports a maxmum of 2 ports while ehci controller supports 6.
(2)If creating vm without usb controller, qemu will default create a piix3-usb-uhci controller but not creating the other type's.
(3)If creating vm with usb device but no usb controller, the usb device will default be attached to the default uhci controller, but speed may mismatch.
(4)There are two ways to support more usb devices. 1. Adding cascaded hubs and attaching usb devices to them. 2.Creating more controllers and connect usb devices to different ones.
(5)If attaching usb-tablet to controller, the vm crashed. Qemu thrown a error(why?)
(5)When creating vm with a pair of usb hub and ehci controller, the vm crashed. Qemu thrown a error(why?)

Consideration about usb controller

I have three alternatives about how to provide this function:

Option 1:

Nova supports function and related API for creating specified type and number usb controller.

When admin/user attach a usb device to virtual machine, him should specify the type of usb controller, then nova will select a matched usb controller/port for this device.

Advantage:

(1)Admin/user can controll what they want. If usb controllers are not enough then admin/user can create new.

(2)Maybe it is more in line with the principle of system expansion.

Shortcoming:

(1)The user operations are complex.

(2)System should manage complex relationship between usb controller and usb device, and making decisions about which usb controller/port to which usb device.


Option 2:

Nova dosen't exposure usb controller operating to admin/user.

When admin/user attach a usb device to virtual machine, him can specify the type of usb controller optionaly, then nova will automatically create appropriate usb controller/port for this device.

Advantage:

(1)The user operations are simpler.

Shortcoming:

(1)System should manage complex relationship between usb controller and usb device, and making decisions about which usb controller/port to which usb device.


Option 3:

Nova creates some default usb controller like ehci, nec-xhci when creating virtual machine.

When admin/user attach a usb device to virtual machine, him can specify the type of usb controller optionaly, then nova will select a matched usb controller/port for this device.

Advantage:

(1)The user operations are simpler.

Shortcoming:

(1)Not all type of usb controller can be supported

(2)There are restrictions for number of suported usb devices(Maybe it is not a problem because normal business scenes don' t need many usb devices)

Consideration about usb-passthrough and hot-plug

The core