Changing the Size of a Server

You can change the size of a server by changing its flavor. Show information about the server to resize and note the value of the flavor property. The size (flavor) of the server is m1.small (2) in the following example:

$ openstack server show myCirrosServer
+-------------------------------------+-------------------------------------+
| Field                               | Value                               |
+-------------------------------------+-------------------------------------+
| status                              | ACTIVE                              |
| updated                             | 2013-07-18T15:08:20Z                |
| OS-EXT-STS:task_state               | None                                |
| OS-EXT-SRV-ATTR:host                | devstack                            |
| key_name                            | None                                |
| image                               | cirros-0.3.2-x86_64-uec (397e71...  |
| private network                     | 10.0.0.3                            |
| hostId                              | <host_id>                           |
| OS-EXT-STS:vm_state                 | active                              |
| OS-EXT-SRV-ATTR:instance_name       | instance-00000005                   |
| OS-EXT-SRV-ATTR:hypervisor_hostname | devstack                            |
| flavor                              | m1.small (2)                        |
| id                                  | 84c6e57d-a6b1-44...                 |
| security_groups                     | [{u'name': u'default'}]             |
| user_id                             | <user_id>                           |
| name                                | myCirrosServer                      |
| created                             | 2013-07-18T15:07:59Z                |
| tenant_id                           | <tenant_id>                         |
| OS-DCF:diskConfig                   | MANUAL                              |
| metadata                            | {u'description': u'Small test ima...|
| accessIPv4                          |                                     |
| accessIPv6                          |                                     |
| progress                            | 0                                   |
| OS-EXT-STS:power_state              | 1                                   |
| OS-EXT-AZ:availability_zone         | nova                                |
| config_drive                        |                                     |
+-------------------------------------+-------------------------------------+

To change the server size:

  1. List the available sizes.

    $ openstack flavor list
    +--------+-------------+-------+------+-----------+-------+-----------+
    | ID     | Name        |   RAM | Disk | Ephemeral | VCPUs | Is Public |
    +--------+-------------+-------+------+-----------+-------+-----------+
    | 2      | m1.small    |  2048 |   20 |         0 |     1 | True      |
    | 3      | m1.medium   |  4096 |   40 |         0 |     2 | True      |
    | 4      | m1.large    |  8192 |   80 |         0 |     4 | True      |
    | 5      | m1.xlarge   | 16384 |  160 |         0 |     8 | True      |
    +--------+-------------+-------+------+-----------+-------+-----------+
    
  2. Resize the server using the resize command with the server ID or name and the new flavor.

    $ openstack server resize myCirrosServer 4
    

    Note
    By default, the resize command gives the guest operating system a chance to perform a controlled shutdown before the instance is powered off and the instance is resized. The default timeout is 60 seconds.

  3. Show the status of the server. When the resize completes, the status becomes VERIFY_RESIZE.

    $ openstack server list
        
    +----------------------+----------------+--------+-----------------------------------------+
    | ID                   | Name           | Status | Networks                                |
    +----------------------+----------------+--------+-----------------------------------------+
    | 84c6e57d-a6b1-44b... | myCirrosServer | RESIZE | private=172.16.101.6, public=10.4.113.6 |
    +----------------------+----------------+--------+-----------------------------------------+
    
  4. Confirm to activate the resize and update to ACTIVE status.

    $ openstack resize --confirm 84c6e57d-a6b1-44b...
    $ openstack server list
        
    +----------------------+----------------+--------+-----------------------------------------+
    | ID                   | Name           | Status | Networks                                |
    +----------------------+----------------+--------+-----------------------------------------+
    | 84c6e57d-a6b1-44b... | myCirrosServer | ACTIVE | private=172.16.101.6, public=10.4.113.6 |
    +----------------------+----------------+--------+-----------------------------------------+
    
  5. If the resize fails or does not work as expected, you can revert the resize.

    $ openstack resize --revert 84c6e57d-a6b1-44b...