Skip to content

Switch Flavors

Flavors are pre-configured templates that specify the amount of CPU, RAM, and disk space available to a VM. Switching flavors refers to changing the flavor of an existing VM, essentially upgrading or downgrading its resources according to the new flavor's specifications.

Benefits of Switching Flavors

Scalability: Switching flavors allows users to scale their VMs up or down based on changing resource requirements. For example, if an application running on a VM experiences higher demand, you can switch to a flavor with more CPU and RAM to handle the increased load.

Cost Efficiency: By switching to a smaller flavor when fewer resources are needed, users can reduce their cloud costs.

Flexibility: As business needs evolve, the ability to quickly adjust the resources of a VM without having to create a new instance provides flexibility and minimizes downtime.

Performance Optimization: Switching to a more powerful flavor can improve the performance of applications running on a VM, ensuring they have sufficient resources to operate efficiently.

Important

Resizing an instance will trigger a reboot. If you revert the resize, the instance will be rebooted again.

Switch Flavors

  • Resize the instance: navigate to Project > Compute > Instances and in the Actions dropdown select Resize Instance. In the popup window that appears choose the new flavor and click Resize.
  • Verification: Ensure the instance is functioning correctly with the new resources.
  • Revert Resize/Migrate: If there are any issues in the resized instance, you can rollback to the previous state by selecting Revert Resize/Migrate in the Actions dropdown.
  • Confirm Resize: After resizing, you will need to confirm the operation to finalize the changes. The instance will enter a Confirm or Revert Resize/Migrate state until confirmation. Confirmation timeout is set to 1h. After that period the resize will be automatically confirmed.

Suppose you have an instance with 2 vCPUs and 2GB of RAM and need to scale up to 4 vCPUs and 8GB of RAM:

  • Original Flavor: c002r002 (2 vCPUs, 2GB RAM)
  • New Flavor: c004r008 (4 vCPUs, 8GB RAM)

Check current size of an instance:

openstack server show <SERVER_ID>
Example output
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field                               | Value                                                                                                                                                                                       |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| OS-DCF:diskConfig                   | AUTO                                                                                                                                                                                        |
...
| flavor                              | description=, disk='0', ephemeral='0', , id='c002r002', is_disabled=, is_public='True', location=, name='c002r002', original_name='c002r002', ram='2048', rxtx_factor=, swap='0', vcpus='2' |
...
| volumes_attached                    | delete_on_termination='False', id='c76abb8a-2712-4dea-a31c-8c9702e0b20b'                                                                                                                    |
|                                     | delete_on_termination='False', id='73d06e23-6de8-40b0-b72c-205924bf6f6c'                                                                                                                    |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

List available flavors to find the desired new flavor ID:

openstack flavor list
Example output
+--------+----------+--------+------+-----------+-------+-----------+
| ID     | Name     |    RAM | Disk | Ephemeral | VCPUs | Is Public |
+--------+----------+--------+------+-----------+-------+-----------+
| 001001 | c001r001 |   1024 |    0 |         0 |     1 | True      |
...

| 004008 | c004r008 |   8192 |    0 |         0 |     4 | True      |
...
| 032256 | c032r256 | 262144 |    0 |         0 |    32 | True      |
+--------+----------+--------+------+-----------+-------+-----------+

Resize the instance (no output; check status separately):

openstack server resize --flavor c004r008 <server_id>

Check server status (if the status is RESIZE, then the resize operation is still ongoing). After the resize operation completes, the instance will enter VERIFY_RESIZE status, meaning that the resize operation is done but needs to be confirmed).

openstack server show <server_id>
Example output
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field                               | Value                                                                                                                                                                                       |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| OS-DCF:diskConfig                   | MANUAL                                                                                                                                                                                      |
...
| status                              | VERIFY_RESIZE                                                                                                                                                                               |
...
| volumes_attached                    | delete_on_termination='False', id='c76abb8a-2712-4dea-a31c-8c9702e0b20b'                                                                                                                    |
|                                     | delete_on_termination='False', id='73d06e23-6de8-40b0-b72c-205924bf6f6c'                                                                                                                    |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Revert the resize if there are any issues with the resized instance (no immediate output; the instance status will change to REVERT_RESIZE during the revert process). After the revert is complete, the instance will return to ACTIVE with its original flavor.

openstack server resize revert <server_id>

Confirm the resize if the instance is functioning as expected (no immediate output):

openstack server resize confirm <server_id>

Check the instance status:

openstack server show <server_id>

To confirm the number of CPUs log in to the instance and run:

lscpu
Example output
Architecture:             x86_64
CPU(s):                 4
On-line CPU(s) list:    0-3
Model name:             AMD EPYC-Rome Processor

To confirm the amount of RAM run:

free -h
Example output
            total        used        free      shared  buff/cache   available
Mem:           7.8Gi       426Mi       7.4Gi       4.1Mi       217Mi       7.3Gi
Swap:             0B          0B          0B