Jump to: navigation, search

Main Page/cobbler

..

This work is licensed under a Creative Commons Attribution 3.0 Unported
License.
http://creativecommons.org/licenses/by/3.0/legalcode
========================================

Support passthrough of USB device

========================================

We provide VDI(Virtual Desktop) and server virtualization solutions for customers, our customers have strong requirements for using USB devices.

The typical use cases and our solutions are described as below: 1.In VDI solution, customers want to use local USB printers or USB scanners with TC(Thin-Client), because remote desktop protocol like ICA have already support USB-redirection, so customers only need to attach USB device to TC, the protocol can map USB device to VM.

2. In virtualization solution, when starting or restarting some business-critical applications, a connected USB-KEY is needed for authentication, some applications even need a daily authentication by USB-KEY. we suggest the following solutions: (1) Using physical 'USB-HUB' box and technology of USB-redirection over TCP/IP. Customers need to buy USB-HUB and install software in guest os, the software helps redirecting USB device to VM.

(2) Using USB-Passthrough functions provided by our virtualization software. The end users(normally application or system administrators) insert USB devices to host that containing the VM, then can see USB device list in portal and choose USB device to attach.

This solution has advantages that

1. It doesn't need additional physical devices.

2. It doesn't need a special server to run spice client for USB-Redirection.

3. Business-critical applications commonly need stable and long-standing USB-KEY to attach, USB-Passthrough maybe more stable than USB-Redirection over TCP/IP or remote desktop protocol.

As described above, I think USB-Passthrough is valuable in Openstack.

This BP is focus on how to provide USB-Passthrough function in Openstack.


Problem description

=======

Use cases:

In private cloud, a end user wants to create a VM to run ERP software which needs a USB-KEY for authentication, he proposes request to system administrator, they perform the following steps:

1. The administrator goes to the machine room and chooses a host to insert USB-KEY to.

2. The administrator adds some configuration(like white-list with USB-KEY's product and vendor information) to nova-compute, restart nova-compute to trigger it to discovery new devices and save them to DB.

3. The administrator queries USB-KEY information from API or portal

4. The administrator creates a flavor with USB-KEY information queried by above.

5. The end user creates a VM with above flavor, the system chooses the host which contains the USB-KEY to run VM and attach USB-KEY to it.

Proposed change

===

The idea of how to implement this function can reference to pci-passthrough.

We should add the following functions to nova:

1. Nova should support to auto-discover usb devices and save them in DB.

2. Nova should support to create a flavor which contains usb device information.

3. Nova should support to create VM with a flavor which contains usb device information.

Alternatives


None

Data model impact


The idea of how to implement this function can reference to pci-passthrough.

1. In libvirt driver layer, add function to discover USB devices. A white-list maybe needed here to filter proper devices.

2. In DB layer, (1) add a new table 'usb_devices' to store USB device information. (2) add a key-value pair to instance_system_metadata table to store USB device information which have been assigned to the VM.

3. In scheduler layer, add a filter to find host which contains the usb devices.

4. The schema of flavor which contains USB device information may like this: {"usb_devices":[{"id": 5}]}


REST API impact


None

Security impact


None

Notifications impact


None

Other end user impact


This new function may have some impacts to other exist functions, I recognise the followings by now:

1. A VM with USB device doesn't support to do migration(live-migration, with shared storage or not).

2. It maybe necessary for the user of USB device to pop-up USB device in guest os before detach it from VM. The hazard of not pop-up USB device is just as detach a USB device from physical server.

3. It maybe necessary to detach USB device before snapshot a VM and then attach USB device after that.

4. The physical information of USB device like bus id, device id maybe changed every time the host been restarted. If this problem happens, the user need to detach the old invalid USB device and re-attach the USB device by the new bus id, device id.

5. When delete a VM with USB device, the USB device should be detached and the USB device usage information should be updated.

6. We plan to provide this function in KVM/libvirt environment but not support it in xen.


Performance Impact


None


Other deployer impact


None


Developer impact


How to distinguish USB devices is important because user wants to specify which USB device to which VM. I think this function can reference to idea of pci-passthrough.

1. The key information of USB device which are supported by libvirt by now are vendor id, product id, bus and device. Bellow is a example:

<hostdev mode='subsystem' type='usb'>

<vendor id='0x136b'/>
<product id='0x0003'/>
<address bus='2' device='3'/>

</hostdev>

Different USB devices may have the same vendor id and product id, so they are not appropriate.

The bus+device maybe a good choice to distinguish USB devices, but device id may change every time the host restart.

The physical controller 'port id' which USB device attach to maybe the best choice, but libvirt doesn't support it by now.

So I think bus+device maybe the best choice by now.

2. Add a white-list to nova.conf for nova-compute to discovery USB device. The schema may like: usb_passthrough_whitelist = [{"bus": "2", "device": "2"}]

Implementation

==

Assignee(s)


Primary assignee:

 <Jing Yuan>


Work Items


Step 1: Implement function of discover usb device in libvirt driver.

Step 2: Implement function of periodically update USB device information from nova-compute to DB.

Step 3: Implement function of create VM with USB device.

Step 4: Make changes to other functions which are affected by this new function.

Dependencies

==

None


Testing

=

It is necessary to add tempest for this new function.


Documentation Impact

========

It is necessary to add doc for how to use this new function.


References

==

None

yuanjing ..

This work is licensed under a Creative Commons Attribution 3.0 Unported
License.
http://creativecommons.org/licenses/by/3.0/legalcode
========================================

Add support for USB controller

========================================

Users have requirement of using USB devices, the detailed information can reference the bp of https://blueprints.launchpad.net/nova/+spec/usb-passthrough.

If not specify appropriate type of USB controller for USB device, USB device will use the default piix3-usb-uhci, the default USB device's speed may mismatch with USB device. This result in the following problems.

1. The low speed of USB device.

2. If use spice client to redirect USB device to VM, the mismatched speed may prevent the connection.

As described above, I think specify USB controller for USB-passthrough is valuable in Openstack.


Problem description

=======

Use cases:

1. The administrator creates a VM with flavor which contains USB device information and USB controller information.

2. The system creates VM with USB controller specified in flavor above, it also attach USB device to the created USB controller but not the default piix3-usb-uhci.


Proposed change

===

We should add the following functions to nova: 1. When create flavor with USB device, specify the USB controller type for USB device.

2. Nova should support to attach USB device to specified USB controller when create VM.

Alternatives


None

Data model impact


1. The schema of flavor which contains USB device information and USB controller information may like this: {"usb_devices":[{"id": 5, "usb_controller_type": "ehci"}]}

2. In libvirt driver layer, add function to specify USB controller for USB device. Bellow is a example:

<hostdev mode='subsystem' type='usb'>

<address bus='2' device='3'/>

<address type='usb' bus='1' port='2'/> </hostdev>

System should select not duplicate port for USB device to attach.

3. In DB layer, add USB controller type parameter to USB device information which have been assigned to the VM.


REST API impact


NULL

Security impact


None

Notifications impact


None

Other end user impact


None

Performance Impact


None

Other deployer impact


None

Developer impact


None

Implementation

==

Assignee(s)


Primary assignee:

 <Jing Yuan>


Work Items


Step 1: Add USB controller type to USB device data model in libvirt driver.

Step 2: Implement function of choose USB controller port for USB device.

Dependencies

==

NULL


Testing

=

It is necessary to add tempest for this new function.

Documentation Impact

========

It is necessary to add doc for how to use this new function.


References

==

https://blueprints.launchpad.net/nova/+spec/usb-passthrough

https://blueprints.launchpad.net/nova/+spec/usb-passthrough

yuanjing ..

This work is licensed under a Creative Commons Attribution 3.0 Unported
License.
http://creativecommons.org/licenses/by/3.0/legalcode
========================================

Add support for USB controller

========================================

Users have requirement of using USB devices, the detailed information can reference the bp of https://blueprints.launchpad.net/nova/+spec/usb-passthrough.

If not specify appropriate type of USB controller for USB device, USB device will use the default piix3-usb-uhci, the default USB controller's speed may mismatch with USB device. This result in the following problems.

1. The low speed of USB device.

2. If use spice client to redirect USB device to VM, the mismatched speed may prevent the connection.

As described above, I think USB controller is valuable in Openstack.


Problem description

=======

Use cases:

1. The administrator creates a flavor with USB controller information, the key parameter is type like ehci.

2. The administrator creates a VM with flavor created above, the system creates USB controller for the VM.


Proposed change

===

We should add the following functions to nova: 1. When create flavor, specify a key-value for USB controller, the schema may like: {"usb_controllers":[{"type":"ehci"}]}

2. Nova should support to create USB controller in libvirt driver when create VM.

Alternatives


None

Data model impact


We should add USB controller data model in libvirt driver for constructing USB controller xml when create VM.


REST API impact


None

Security impact


None

Notifications impact


None

Other end user impact


None

Performance Impact


None

Other deployer impact


None

Developer impact


None

Implementation

==

Assignee(s)


Primary assignee:

 <Jing Yuan>


Work Items


Step 1: Implement function of construct USB controller xml in libvirt driver.

Step 2: Implement function of create USB controller when create VM.

Dependencies

==

None


Testing

=

It is necessary to add tempest for this new function.


Documentation Impact

========

None


References

==

https://blueprints.launchpad.net/nova/+spec/usb-passthrough