How to increase instance memory in OpenStack

Dear Friend’s, In this tutorial we will see how to increase instance memory in OpenStack step by step. So that you can apply this step when ever you need to increase instance memory.

Sometime we need more RAM to execute some specific task or application which consume lot’s of RAM, in this case we have option to increase instance memory in OpenStack and we can run this task and application with extended memory.

For more info you can also can Click-Here

Here I am following these steps to increase instance memory: –

  1. Display flavor list
  2. Display server list
  3. How to create flavor
  4. How Increase instance memory with extend flavor
  5. Verify the memory of instance after extend.

Display flavor list

First of all we have to display our flavor list using “openstack flavor list” command to check our current flavor list. Like below: –

[stack@undercloud (overcloudrc) ~]$ openstack flavor list
 +--------------------------------------+---------+------+------+-----------+-------+-----------+
 | ID                                   | Name    |  RAM | Disk | Ephemeral | VCPUs | Is Public |
 +--------------------------------------+---------+------+------+-----------+-------+-----------+
 | bec4a148-1b03-47e1-a793-96a905c22ec4 | SMALL_1 | 4096 |    0 |         0 |     4 | True      |
 +--------------------------------------+---------+------+------+-----------+-------+-----------+

You can see currently we have only one flavor which is “SMALL_1”.

Display server list

Now we can display our instance using “openstack server list” where we can find current flavor list also which is apply on our running instances.

[stack@undercloud (overcloudrc) ~]$ openstack server list
 +--------------------------------------+------------+--------+--------------------------+---------------+---------+
 | ID                                   | Name       | Status | Networks                 | Image         | Flavor  |
 +--------------------------------------+------------+--------+--------------------------+---------------+---------+
 | 29d21c66-f49f-4c64-9b40-bfa42b3d16cd | OVS-VM-3   | ACTIVE | Net-10=10.10.10.19       | Rhel7Genereic | SMALL_1 |
 | d85be7e0-98d3-4b1b-8349-c103d225e430 | OVS-VM-2   | ACTIVE | Net-10=10.10.10.13       | Rhel7Genereic | SMALL_1 |
 | 5bc098a3-9052-4ccf-884a-54d09715ebb7 | SRIOV-VM-1 | ACTIVE | SRIOV-Net-20=10.10.20.19 | Rhel7Genereic | SMALL_1 |
 +--------------------------------------+------------+--------+--------------------------+---------------+---------+

In above output you can see, we have 3 running instance which is booted from SMALL_1 flavor. Now I am going to extend RAM of this instance “OVS-VM-3” So first of all we need to create one more flavor with extended memory. So let’s create flavor.

How to create flavor

We can create flavor with below command: –

[stack@undercloud (overcloudrc) ~]$ openstack flavor create extend-4g-to-8g --id 10 --ram 8096 --disk 0 --vcpus 4
 +----------------------------+-----------------+
 | Field                      | Value           |
 +----------------------------+-----------------+
 | OS-FLV-DISABLED:disabled   | False           |
 | OS-FLV-EXT-DATA:ephemeral  | 0               |
 | disk                       | 0               |
 | id                         | 10              |
 | name                       | extend-4g-to-8g |
 | os-flavor-access:is_public | True            |
 | properties                 |                 |
 | ram                        | 8096            |
 | rxtx_factor                | 1.0             |
 | swap                       |                 |
 | vcpus                      | 4               |
 +----------------------------+-----------------+
 [stack@undercloud (overcloudrc) ~]$

We can verify our created flavor with openstack flavor list command. Like below: –

[stack@undercloud (overcloudrc) ~]$ openstack flavor list
 +--------------------------------------+-----------------+------+------+-----------+-------+-----------+
 | ID                                   | Name            |  RAM | Disk | Ephemeral | VCPUs | Is Public |
 +--------------------------------------+-----------------+------+------+-----------+-------+-----------+
 | 10                                   | extend-4g-to-8g | 8096 |    0 |         0 |     4 | True      |
 | bec4a148-1b03-47e1-a793-96a905c22ec4 | SMALL_1         | 4096 |    0 |         0 |     4 | True      |
 +--------------------------------------+-----------------+------+------+-----------+-------+-----------+
 [stack@undercloud (overcloudrc) ~]$

In above output you can see we have successfully created flavor with name “extend-4g-to-8g”. Now we can increase RAM with this flavor.

How Increase instance memory with extend flavor

First of all we need to be properly shutdown of our instance where we want to extend RAM. it would be also better if you take a snapshot of you instance before extended RAM. if there is any inconsistency in your instance during memory increase or after memory increase, then you will have a option to recover your instance using snapshot.

After shutdown your instance you can run this command to increase memory where nova resize is openstack command, OVS-VM is the instance name, 10 is the extended flavor id and –poll is the resize option.

[stack@undercloud (overcloudrc) ~]$ nova resize OVS-VM-3 10 --poll
Server resizing… 100% complete
Finished
[stack@undercloud (overcloudrc) ~]$

You can see in above output we have successfully resize of our instance from 4GB memory to 8GB memory. Now we can start this server and verify our extended flavor has been applied or not?

Verify the memory of instance after extended

We can run “openstack server list” command to check our extended flavor has been applied or not? so let’s check and verify.

increase instance memory

You can see in above output our extended flavor has been successfully applied on our OVS_VM-3.

That’s all we have successfully increase instance memory in OpenStack.

Leave a Reply