Jump to: navigation, search

Nova/USB controller hot cold plug

USB controller hot/cold plug features

Related Content

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

Background

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

User scenarios

When a user wants to copy mass data to a removable media for business trip him may want to use usb data disk. But for high speed, he should first create a ehci usb controller for usb device.

Technical verification

1. Test case

   Adding different type usb controller to vm when vm in diffrent status(running, stopped and so on).

2. Xml definition and commands

   (1)Sample of usb controller:
        <controller type='usb' index='6' model='nec-xhci'/>
   (2)Command of adding usb controller:
        virsh attach-device vm usbcontroller.xml --config
   (3)Command of removing usb controller:
        virsh detach-device vm usbcontroller.xml --config

3. The test results

    (1)Libvirt/qemu only support adding usb controllers to vm or removing controllers from vm when vm in stopped status, just modify the xml configuration.
    (2)Different usb controllers should have uniquet index property.

Proposed solution

1. Use cases

   Case 1:
   (1)Admin/User request to add usb controllers(type) to a vm.
   (2)System first validates usb controller arguments and vm's status, if valid then create usb controllers.
   Note: I can't find requirement for removing usb controller by now.

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

   (1)System supports creating usb controllers.
       The API may like:
       Post  v2/​{tenant_id}​/servers/​{server_id}/action
       {
          "attach_usb_controller": 
          {
             "type": "ehci",
              "count": 2,     
          }   
      }
      The usb controller information can be stored as "usb_controller_requests":"" in instance_system_metadata.