Jump to: navigation, search

Difference between revisions of "Nova/add-support-for-cpu-hotadd"

(Background)
Line 36: Line 36:
 
{
 
{
 
     "cpu_hotplug": {
 
     "cpu_hotplug": {
         "vcpus": 3,
+
         "vcpus": 3
        "mode":"guest"
 
 
     }
 
     }
 
}
 
}
  
 
The 'vcpus' stands the new CPU which the instance has.
 
The 'vcpus' stands the new CPU which the instance has.
 
The 'mode' stands whether the instance supports 'qemu-guest-agent'.
 
  
  
Line 50: Line 47:
  
 
== Note==
 
== Note==
For the hotplug to work,please make sure your QEMU version >= 1.5.0 and the version of libvirt >= 1.1.0 and the machine type >= "pc-i440fx-1.5".
+
For the hotplug to work,please make sure your QEMU version >= 1.5.0 and the version of libvirt >= 1.1.0.

Revision as of 09:46, 9 April 2014

CPU Hot-plug Support - API and Features

Background

Currently we can change the flavor and rebuilt the instance to add CPUs. It is not support adding CPUs to a running instance without of rebuilt it to effect.

We should have the ability add CPUs immediately without the instance's state is changed.

CPU hotplug APIs Based on KVM

1. Add extra key to flavor to define the instance's current CPU.

For example:

key:"cpu:current"

value:"2"

Create VM with max VCPU in flavor.

The instance's XML looks like:

< vcpu current="2">4</vcpu>


2. Set metadata of the image if the image has installed qemu-guest-agent.

nova image-meta {image_id} set hw_qemu_guest_agent=yes


3. Provide the API of setting the new CPU of the instance.

For example:

POST v2/{tenant_id}/servers/{server_id}/action

{

   "cpu_hotplug": {
       "vcpus": 3
   }

}

The 'vcpus' stands the new CPU which the instance has.


4. Add hot-add VCPU in libvirt driver Add method use libvirt API of setVcpusFlags.

Note

For the hotplug to work,please make sure your QEMU version >= 1.5.0 and the version of libvirt >= 1.1.0.