Resize a VM
OpenStack Compute (Nova) has a feature that allows you to change the size of an instance by changing its flavor, namely resize a VM.
- Notes: Only admininistrator users are allowed to call this API in IBM® Cloud Infrastructure Center.
Request parameters
Table 1. Parameters in the resize request
| Name | Style | Type | Required | Description |
|---|---|---|---|---|
| flavorRef | body | string | Required | The flavor ID for resizing the VM. The size of the disk in the
flavor being resized to must be greater than or equal to the size
of the disk in the current flavor.
If a specified flavor ID is the same as the current one of the VM, the request returns a Bad Request (400) response code. |
|
OS-DCF:diskConfig
(Optional) |
body | string | Required | Controls how the API partitions the disk when you resize VMs. A
VM inherits the OS-DCF:diskConfig value from the image from which
it was created, and an image inherits the OS-DCF:diskConfig value
from the VM from which it was created. To override the inherited
setting, you can include this attribute in the request body of a VM
resize request. If the OS-DCF:diskConfig value for an image is
MANUAL, you cannot create a VM from that image and set its
OS-DCF:diskConfig value to AUTO. A valid value is:
Because only KVM resize can change disk flavor, these 2 values work for KVM. For z/VM, resize can not change disks, so setting OS-DCF:diskConfig to AUTO is enough. |
Method
POST
Request URL
https://{host_ip}/icic/openstack/compute/v2.1/{tenant_id}/servers/{vm_id}/action
Example:
Body:
{
"resize" : {
"flavorRef" : 2,
"OS-DCF:diskConfig": "AUTO"
}
}
Response
If successful, this method does not return content in the response body.
Confirm resize
Confirms a pending resize action for a VM. You can only confirm the resized VM where the status is VERIFY_RESIZE. A successfully confirming resize operation shows a status of ACTIVE or SHUTOFF and a migration status of confirmed.
Request parameters
Table 2. Parameters in the confirm resize request
| Name | Style | Type | Required | Description |
|---|---|---|---|---|
| confirmResize | body | none | Required | The action to confirm a resize operation. |
Method
POST
Request URL
https://{host_ip}/icic/openstack/compute/v2.1/{tenant_id}/servers/{vm_id}/action
Example:
Body:
{
"confirmResize": null
}
Response
If successful, this method does not return content in the response body.
Note: In the IBM Cloud Infrastructure Center, the resized VM is automatically confirmed after the VM's status turns into VERIFY_RESIZE for 1 second, because in /etc/nova/nova.conf, resize_confirm_window is set to 1. There is no need to do confirm resize API manually.
Revert resize
Cancels and reverts a pending resize action for a VM. You can only revert the resized VM where the status is VERIFY_RESIZE and the OS-EXT-STS:vm_state is resized. A reverting resize operation shows a status of REVERT_RESIZE and a task_state of resize_reverting. If successful, the status is returned to ACTIVE or SHUTOFF. You can also see the reverted VM in the compute node that OpenStack Compute manages.
Request parameters
Table 3. Parameters in the revert resize request
| Name | Style | Type | Required | Description |
|---|---|---|---|---|
| revertResize | body | none | Required | The action to revert a resize operation. |
Method
POST
Request URL
https://{host_ip}/icic/openstack/compute/v2.1/{tenant_id}/servers/{vm_id}/action
Example:
Body:
{
"revertResize": null
}
Response
If successful, this method does not return content in the response body.
Notes:
- In the IBM Cloud Infrastructure Center, revert resize API is only supported for KVM hypervisor, z/VM is not supported.
- As claimed in confirm resize API part, the resized VM is automatically confirmed, so there is no chance to call a resize revert API. If you like to enable the revert feature, you first need to change resize_confirm_window to 0 (resize not automatically confirmed) or a large value (automatically confirm resize after interval that the value specifies) in /etc/nova/nova.conf on compute nodes. For KVM, /etc/nova/nova.conf on all compute nodes need an update.