Jump to: navigation, search

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

(Created page with "=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...")
 
(CPU hotplug APIs Based on KVM)
Line 8: Line 8:
 
==CPU hotplug APIs Based on KVM==
 
==CPU hotplug APIs Based on KVM==
 
1. Add extra key to flavor to define the instance's current CPU.
 
1. Add extra key to flavor to define the instance's current CPU.
 +
 
For example:
 
For example:
 +
 
key:"cpu:current"  
 
key:"cpu:current"  
 +
 
value:"2"
 
value:"2"
 +
 
Create VM with max VCPU in flavor.
 
Create VM with max VCPU in flavor.
 +
 
The instance's XML looks like:
 
The instance's XML looks like:
 +
 
< vcpu current="2">4</vcpu>
 
< vcpu current="2">4</vcpu>
 +
  
 
2. Set metadata of the image if the image has installed qemu-guest-agent.
 
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
 
nova image-meta {image_id} set hw_qemu_guest_agent=yes
 +
  
 
3. Provide the API of setting the new CPU of the instance.
 
3. Provide the API of setting the new CPU of the instance.
 +
 
For example:
 
For example:
 +
 
POST  v2/{tenant_id}/servers/{server_id}/action
 
POST  v2/{tenant_id}/servers/{server_id}/action
 +
 
{
 
{
 
     "cpu_hotplug": {
 
     "cpu_hotplug": {
Line 27: Line 39:
 
     }
 
     }
 
}
 
}
 +
 
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'.
 
The 'mode' stands whether the instance supports 'qemu-guest-agent'.
 +
  
 
4. Add hot-add VCPU in libvirt driver
 
4. Add hot-add VCPU in libvirt driver

Revision as of 03:56, 2 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,
       "mode":"guest"
   }

}

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

The 'mode' stands whether the instance supports 'qemu-guest-agent'.


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 and the machine type >= "pc-i440fx-1.5".