OpenStack Instance Management with Nova

OpenStack Instance Management with Nova

Nova manages the lifecycle of compute instances in an OpenStack environment. Responsibilities include spawning, scheduling and decommissioning of machines on demand. Nova is used in Horizon through the Instance management and the Access and Security sections.

For more details, refer to Nova’s documentation: https://wiki.openstack.org/wiki/Nova

Notes:
  • Before you can use Nova, make sure the OpenStack Command Line Interface tools are installed on your workstation
  • Nova works for all server platform (AgileCLOUD, AgileSERVER)

Here are a few examples of what you can achieve with Nova:

  • List all possible options with Nova using nova help
$ nova help
  • List all your instances with nova list
$ nova list
+--------------------------------------+---------------------------------+--------+------------+-------------+------------------------------------+
| ID                                   | Name                            | Status | Task State | Power State | Networks                           |
+--------------------------------------+---------------------------------+--------+------------+-------------+------------------------------------+
| 382a79a5-815c-4736-886e-33f2dd2a19ba | plsrvtest.cloudeng.internap.com | ACTIVE | -          | Running     | inap-17686-LAN2406=10.10.10.10     |
+--------------------------------------+---------------------------------+--------+------------+-------------+------------------------------------+
  • Show the details of a specific instance using nova show instance_uuid
$ nova show 382a79a5-815c-4736-886e-33f2dd2a19ba
+--------------------------------------+---------------------------------------------------------------+
| Property                             | Value                                                         |
+--------------------------------------+---------------------------------------------------------------+
| OS-EXT-STS:power_state               | 1                                                             |
| OS-EXT-STS:task_state                | -                                                             |
| OS-EXT-STS:vm_state                  | active                                                        |
| accessIPv4                           |                                                               |
| accessIPv6                           |                                                               |
| config_drive                         | True                                                          |
| created                              | 2016-08-31T17:52:19Z                                          |
| flavor                               | AS1.1xE3-1270v2.8GB.1x1TB.HDD (AS1.1xE3-1270v2.8GB.1x1TB.HDD) |
| hostId                               | 4fa3ef727eb38330f289a50aa7a2493940f43e0bc35e72d9fd5dd308      |
| id                                   | 382a79a5-815c-4736-886e-33f2dd2a19ba                          |
| image                                | 8e934744-6e1c-44aa-9746-9db225688b54                          |
| inap-17686-WAN2406 network           | 10.10.10.10                                                   |
| key_name                             | -                                                             |
| metadata                             | {}                                                            |
| name                                 | plsrvtest.cloudeng.internap.com                               |
| os-extended-volumes:volumes_attached | []                                                            |
| progress                             | 0                                                             |
| security_groups                      | default                                                       |
| status                               | ACTIVE                                                        |
| tenant_id                            |                                                               |
| updated                              | 2016-08-31T17:52:33Z                                          |
| user_id                              |                                                               |
+--------------------------------------+---------------------------------------------------------------+
  • Create an instance with nova boot
$ nova boot --flavor A1.1 --image d5e57248-1523-4765-9b43-66f0e2cc7ed8 --nic net-id=1e47534d-ffaa-40f7-8be0-f7ba122d6525 kb_instance.internap.com
+--------------------------------------+-------------------------------------------------+
| Property                             | Value                                           |
+--------------------------------------+-------------------------------------------------+
| OS-EXT-STS:power_state               | 0                                               |
| OS-EXT-STS:task_state                | scheduling                                      |
| OS-EXT-STS:vm_state                  | building                                        |
| accessIPv4                           |                                                 |
| accessIPv6                           |                                                 |
| adminPass                            | Z2Biy5oz4M85                                    |
| config_drive                         |                                                 |
| created                              | 2016-09-01T19:47:40Z                            |
| flavor                               | A1.1 (A1.1)                                     |
| hostId                               |                                                 |
| id                                   | 88c1f1be-ae80-458a-a4db-f18d5cac9ca9            |
| image                                | CentOS 6 (d5e57248-1523-4765-9b43-66f0e2cc7ed8) |
| key_name                             | -                                               |
| metadata                             | {}                                              |
| name                                 | kb_instance.internap.com                        |
| os-extended-volumes:volumes_attached | []                                              |
| progress                             | 0                                               |
| security_groups                      | default                                         |
| status                               | BUILD                                           |
| tenant_id                            | ec839bacb42949f49a26a9144836d61f                |
| updated                              | 2016-09-01T19:47:41Z                            |
| user_id                              | b6087078de484964b13c0e60c7163fc6                |
+--------------------------------------+-------------------------------------------------+
  • Generate an SSH key pair for key authentication on your instances with nova keypair-add
Note:

The “.pem” file will be located on your workstation so that you can specify it for SSH. You can then boot a nova instance while specifying the key instead of using a password

$ nova keypair-add my_key > my_key.pem
$ nova boot --flavor A1.1 --image d5e57248-1523-4765-9b43-66f0e2cc7ed8 --key_name my_key  --nic net-id=1e47534d-ffaa-40f7-8be0-f7ba122d6525 kb_instance.internap.com
$ ssh -i my_key.pem root@10.10.10.10
  • Execute remote actions on an instance using nova start, stop, reboot, pause, unpause, …
$ nova stop 294da947-95bd-4011-8bc7-ab653f2d29fe
Request to stop server kb_instance.internap.com has been accepted.

$ nova start 294da947-95bd-4011-8bc7-ab653f2d29fe
Request to start server kb_instance.internap.com has been accepted.
  • Change the flavor of an instance (Only for AgileCLOUD) using nova resize
Note:

You will need to go in Horizon to confirm the resize after you have executed the nova resize command

$ nova resize kb_instance.internap.com A1.2
  • Re-image an instance with nova rebuild
$ nova rebuild kb_instance.internap.com d5e57248-1523-4765-9b43-66f0e2cc7ed8
+----------------------------+----------------------------------------------------------+
| Property                   | Value                                                    |
+----------------------------+----------------------------------------------------------+
| accessIPv4                 |                                                          |
| accessIPv6                 |                                                          |
| adminPass                  | muu8gewA8eK4                                             |
| created                    | 2016-09-01T20:30:36Z                                     |
| flavor                     | A1.2 (A1.2)                                              |
| hostId                     | a0d592f3c8f802b02d351b61fc3a4198b42c514e65daa03babcde47f |
| id                         | 294da947-95bd-4011-8bc7-ab653f2d29fe                     |
| image                      | CentOS 6 (d5e57248-1523-4765-9b43-66f0e2cc7ed8)          |
| inap-17686-LAN3390 network | 172.27.111.201                                           |
| metadata                   | {}                                                       |
| name                       | kb_instance.internap.com                                 |
| progress                   | 0                                                        |
| status                     | REBUILD                                                  |
| tenant_id                  | ec839bacb42949f49a26a9144836d61f                         |
| updated                    | 2016-09-01T20:37:16Z                                     |
| user_id                    | b6087078de484964b13c0e60c7163fc6                         |
+----------------------------+----------------------------------------------------------+ 
  • Terminate an instance with nova delete
$ nova delete kb_instance.internap.com
Request to delete server kb_instance.internap.com has been accepted.