Jump to: navigation, search

Difference between revisions of "Nova/USB device&USB controller"

(Proposed solution)
(USB device and USB controller Features)
Line 1: Line 1:
 
== USB device and USB controller Features ==  
 
== USB device and USB controller Features ==  
 
=== Background ===
 
=== Background ===
Currently, nova has already supported pci-passthrough, but still dosen't support usb-passthrough. In fact usb device is a kind of necessary device in some user scenarios in private cloud.   
+
Currently, nova has already supported function of pci-passthrough, but dosen't support usb-passthrough by now.  
 +
I think usb-passthrough is also a important and necessary function especially in private cloud.   
  
 
=== User scenarios ===
 
=== User scenarios ===
1. When i transfer money online, i need a usb-key provided by bank for authentication.
+
1. When a user transfer money online, him may need a usb-key provided by bank for authentication.
  
2. When i start a erp software,  i need a usb-key provided by software provider for authentication.
+
2. When a user run a ERP software,  him may need a usb-key provided by software provider for authentication.
  
3. I need a usb data disk for transferring business data.
+
3. When a user want to copy data to a removable media for business trip him may want a usb data disk.
  
 
=== Technical verification ===
 
=== Technical verification ===
Line 18: Line 19:
 
     <controller type='usb' index='1' model='ehci'/>
 
     <controller type='usb' index='1' model='ehci'/>
  
   (2)Sample of host usb device pass-through
+
   (2)Sample of pass-through usb devices
 
     <hostdev mode='subsystem' type='usb'>
 
     <hostdev mode='subsystem' type='usb'>
 
     < source>
 
     < source>
Line 28: Line 29:
 
     </hostdev>
 
     </hostdev>
  
   (3)Sample of emulated usb disk
+
   (3)Sample of emulated usb type disks
 
       <disk type='file' device='disk'>
 
       <disk type='file' device='disk'>
 
       <driver name='qemu' type='qcow2'/>
 
       <driver name='qemu' type='qcow2'/>
Line 36: Line 37:
 
     </disk>
 
     </disk>
 
3. The test results
 
3. The test results
   (1)Usb controllers have a maximum port restriction. Uhci controller support 2 port while ehci controller support 6 port.
+
   (1)Usb controllers have a maximum port restriction. Uhci controller support maxmum of 2 while ehci controller support maxmum of 6.
   (2)If create vm without usb controller, the qemu will default create a usb 1.1 controller but not other type's controllers.
+
   (2)If create vm without usb controller, qemu will default create a uhci controller but not support creating other type of controllers.
   (3)If create vm with usb device but not usb controller, the usb device will default attach to uhci controller, but the speed may mismatch.
+
   (3)If create 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 for more usb devices. 1. Add cascaded hubs. 2.Create more controllers.
+
   (4)There are two ways for supporting more usb devices. 1. Add cascaded hubs and connect usb devices to hubs. 2.Create more controllers and connect usb devices to different controllers.
   (5)When create vm with a pair of usb hub and ehci controller, the vm crashed.
+
   (5)When create vm with a pair of usb hub and ehci controller, the vm crashed. Error was thrown by qemu(why?)
  
 
=== Proposed solution ===
 
=== Proposed solution ===

Revision as of 12:14, 27 February 2014

USB device and USB controller Features

Background

Currently, nova has already supported function of pci-passthrough, but dosen't support usb-passthrough by now. I think usb-passthrough is also a important and necessary function especially in private cloud.

User scenarios

1. When a user transfer money online, him may need a usb-key provided by bank for authentication.

2. When a user run a ERP software, him may need a usb-key provided by software provider for authentication.

3. When a user want to copy data to a removable media for business trip him may want a usb data disk.

Technical verification

1. Test case

   Attach different number of usb devices to different type of usb controllers.

2. Xml definition

  (1)Sample of usb controller:
   <controller type='usb' index='2' model='piix3-uhci'/>
   <controller type='usb' index='1' model='ehci'/>
  (2)Sample of pass-through usb devices
   <hostdev mode='subsystem' type='usb'>
    < source>
     <vendor id='0x136b'/>
     <product id='0x0003'/>
     <address bus='2' device='2'/>
    </source>
    <address type='usb' bus='1' port='1'/>
   </hostdev>
  (3)Sample of emulated usb type disks
     <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      < source file='/home/vms/usb/sdb.qcow2'/>
      <target dev='sdb' bus='usb'/>
      <address type='usb' bus='1' port='1'/>
    </disk>

3. The test results

  (1)Usb controllers have a maximum port restriction. Uhci controller support maxmum of 2 while ehci controller support maxmum of 6.
  (2)If create vm without usb controller, qemu will default create a uhci controller but not support creating other type of controllers.
  (3)If create 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 for supporting more usb devices. 1. Add cascaded hubs and connect usb devices to hubs. 2.Create more controllers and connect usb devices to different controllers.
  (5)When create vm with a pair of usb hub and ehci controller, the vm crashed. Error was thrown by qemu(why?)

Proposed solution

1. use cases

   Case 1:
   (1)Admin/User create a flavor with usb controllers(key parameters: type, quantity). 
   (2)Admin/User create a vm with flavor above, the system create controllers with specified type and quantiy.
   
   Case 2:
   (1)Admin/User create a flavor with usb devices(key parameters: identifiers that can find the device, like in which host, bus number and device number and so on).
   (2)Admin/User create a vm with flavor above, the system check if usb devices are in the same host and available, then create vm in the host with usb devices attached to default uhci controller. 
   Case 3:    
   (1)Admin/User create a flavor with usb controllers(key parameters: type, quantity) and usb devices(key parameters: identifiers and usb controller type).
   (2)Admin/User create a vm with flavor above, the system check if usb devices are in the same host, available and matching usb controllers,  then create controllers and attach usb devices to matched controllers.  

2. Key processes