Jump to: navigation, search

Difference between revisions of "Nova/USB device hot cold plug"

(Technical verification)
(Proposed solution)
Line 46: Line 46:
 
=== Proposed solution ===
 
=== Proposed solution ===
 
1. Use cases  
 
1. Use cases  
 +
    Case 1:
 +
  (1)Admin/User request to query usb devices information of a host(compute node).
 +
  (2)System return usb devices information of a host.
 +
 +
    Case 2:
 +
  (1)Admin/User request to attach usb devices(key arguments: unique identifiers of devices, usb controller type) to a vm.
 +
  (2)System first validates usb arguments and vm's status, if valid then attach usb devices to vm.
 +
 +
  Case 3:
 +
  (1)Admin/User request to attach usb devices(key arguments: unique identifiers of devices, usb controller type) to a vm.
 +
  (2)System first validates usb arguments and vm's status, if valid then attach usb devices to vm.
 +
 
  
 
2. System requirements and things should be considered(An optional Implementation):
 
2. System requirements and things should be considered(An optional Implementation):

Revision as of 09:31, 4 March 2014

USB device hot/cold plug features

Related Content

https://wiki.openstack.org/wiki/Nova/USB_device%26USB_controller

https://wiki.openstack.org/wiki/Nova/USB_controller_hot_cold_plug

Background

Adding usb devices to a exist vm is a necessary supplement features to usb device passthrough.

User scenarios

When a user transfers money online, him may need to attach a usb-key provided by bank to vm for authentication.

Technical verification

1. Test case

   (1)Attaching different type and number usb controllers and usb devices to vm when vm in diffrent status(running, stopped and so on).
   (2)Detaching usb devices from vm when vm in diffrent status(running, stopped and so on).

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)Command of adding usb controller:
       virsh attach-device vm usb.xml --config
       virsh attach-device vm usb.xml
  (4)Command of removing usb controller:
       virsh detach-device vm usb.xml --config
       virsh detach-device vm usb.xml

3. The test results

   (1)Libvirt/qemu support attaching usb device to vm or removing usb device from vm when vm in stopped status, just modify vm xml configuration.
   (2)Libvirt/qemu support attaching usb device to vm or removing usb device from vm when vm in running/suspended status, not only modify vm xml configuration but apply changes to guest os.

Proposed solution

1. Use cases

   Case 1:
  (1)Admin/User request to query usb devices information of a host(compute node).
  (2)System return usb devices information of a host.
   Case 2:
  (1)Admin/User request to attach usb devices(key arguments: unique identifiers of devices, usb controller type) to a vm.
  (2)System first validates usb arguments and vm's status, if valid then attach usb devices to vm.
  Case 3:
  (1)Admin/User request to attach usb devices(key arguments: unique identifiers of devices, usb controller type) to a vm.
  (2)System first validates usb arguments and vm's status, if valid then attach usb devices to vm.
  

2. System requirements and things should be considered(An optional Implementation):