Using the Rackspace Nova Client

List your Cloud Servers

You can list all your servers by simply using the nova client’s list sub-command.

$ nova list
+--------------------------------------+-----------------------+--------+------------+-------------+--------------------------------------------------------------------------------------+
| ID                                   | Name                  | Status | Task State | Power State | Networks                                                                             |
+--------------------------------------+-----------------------+--------+------------+-------------+--------------------------------------------------------------------------------------+
| 3c0fe504-6610-4e96-b2d3-5286cd2173db | dummydomains          | ACTIVE | -          | Running     | public=95.138.171.74, 2a00:1a48:7805:113:be76:4eff:fe08:c88d; private=10.179.67.247  |
| 128daa81-6f7e-44f8-bb8d-7a215b380535 | nginx-01              | ACTIVE | -          | Running     | public=162.13.12.107, 2a00:1a48:7806:114:be76:4eff:fe08:1583; private=10.179.128.178 |
| e2f591f4-c48e-4ac3-b926-516e5a40ea24 | repository            | ACTIVE | -          | Running     | public=2a00:1a48:7806:116:936d:610a:ff08:6531, 161.13.14.156; private=10.177.5.144   |
+--------------------------------------+-----------------------+--------+------------+-------------+--------------------------------------------------------------------------------------+

Nova Help

The nova client comes with a help subcommand.

$ nova help

You can find out more about how to use other subcommands by passing their names as arguments to the help subcommand. For example, to find out more about the list subcommand:

[andy@bashful ~]$ nova help list
usage: nova list [--reservation-id <reservation-id>] [--ip <ip-regexp>]
                 [--ip6 <ip6-regexp>] [--name <name-regexp>]
                 [--instance-name <name-regexp>] [--status <status>]
                 [--flavor <flavor>] [--image <image>] [--host <hostname>]
                 [--all-tenants [<0|1>]] [--tenant [<tenant>]] [--deleted]
                 [--fields <fields>] [--minimal]

List active servers.

Optional arguments:
  --reservation-id <reservation-id>
                                Only return servers that match reservation-id.
  --ip <ip-regexp>              Search with regular expression match by IP
                                address.
  --ip6 <ip6-regexp>            Search with regular expression match by IPv6
                                address.
  --name <name-regexp>          Search with regular expression match by name
  --instance-name <name-regexp>
                                Search with regular expression match by server
                                name.
  --status <status>             Search by server status
  --flavor <flavor>             Search by flavor name or ID
  --image <image>               Search by image name or ID
  --host <hostname>             Search servers by hostname to which they are
                                assigned (Admin only).
  --all-tenants [<0|1>]         Display information from all tenants (Admin
                                only).
  --tenant [<tenant>]           Display information from single tenant (Admin
                                only).
  --deleted                     Only display deleted servers (Admin only).
  --fields <fields>             Comma-separated list of fields to display. Use
                                the show command to see which fields are
                                available.
  --minimal                     Get only uuid and name.

Build a Server

To build a cloud server, you need to have two bits of information to hand:

  1. The image ID you want to boot with
  2. The ID of the virtual machine (flavour) you want to create

Choose an Image

To spin-up a new server, you need to decide which distribution you’re going to build it with. To see the list of available images, use the below command. Note, this will also include any server images you may have already taken.

$ nova image-list
+--------------------------------------+----------------------------------------------------------------------------------------------+--------+--------------------------------------+
| ID                                   | Name                                                                                         | Status | Server                               |
+--------------------------------------+----------------------------------------------------------------------------------------------+--------+--------------------------------------+
| 6904b226-f20f-454d-9f7d-a0f32bc7af22 | Arch 2015.2 (PVHVM)                                                                          | ACTIVE |                                      |
| d2fa624e-a6ec-4752-a738-81fc4b2462af | CentOS 5 (PV)                                                                                | ACTIVE |                                      |
| 2318853e-f3b1-4cf4-b1a4-d7db71ca9b50 | CentOS 6 (PV)                                                                                | ACTIVE |                                      |
| 4f465d85-4512-44a9-9301-0412f0928f8b | CentOS 6 (PVHVM)                                                                             | ACTIVE |                                      |
| 126a6674-6308-421f-801e-fc302ab4f53f | CentOS 7 (PVHVM)                                                                             | ACTIVE |                                      |
| 2f120d3a-9c30-4056-bd41-a233de98e2ba | CoreOS (Alpha)                                                                               | ACTIVE |                                      |
| 64be157e-13c1-4b83-a806-564b6f20f30b | CoreOS (Beta)                                                                                | ACTIVE |                                      |
| 05438eb5-af42-4bdd-bd32-309c2154927d | CoreOS (Stable)                                                                              | ACTIVE |                                      |
| cad1e45d-fcb9-489d-850c-a61c0537fa55 | Debian 6 (Squeeze) (PV)                                                                      | ACTIVE |                                      |
| f211a88e-4cc0-4660-bda1-56495b05cda2 | Debian 7 (Wheezy) (PVHVM)                                                                    | ACTIVE |                                      |
| e584bfca-afc4-4fd2-bd2f-a8d9ecde47ff | Debian Testing (Jessie) (PVHVM)                                                              | ACTIVE |                                      |
| 1e9d1590-415f-483f-8473-b52d329d9861 | Debian Unstable (Sid) (PVHVM)                                                                | ACTIVE |                                      |
| eabb9ed2-1318-4948-9de6-f378bb07a33e | Fedora 20 (Heisenbug) (PVHVM)                                                                | ACTIVE |                                      |
| 03ce0d51-7d3f-489b-845d-9edff88b40f9 | Fedora 21 (PVHVM)                                                                            | ACTIVE |                                      |
| b49f8b6d-7b31-47e3-8cc4-a2c0a9292e97 | FreeBSD 10 (PVHVM)                                                                           | ACTIVE |                                      |
| 8e31be89-b93a-4526-8a25-da99555f79f0 | Gentoo 15.1 (PVHVM)                                                                          | ACTIVE |                                      |
| f370935d-1aa9-47ac-b1c2-8b030b7386a4 | OpenSUSE 13.2 (PVHVM)                                                                        | ACTIVE |                                      |
| 62a553fc-a010-4ac5-93d2-a40a96ae07a2 | Red Hat Enterprise Linux 5 (PV)                                                              | ACTIVE |                                      |
| 1673126e-4f9d-486e-8bde-190cf7564211 | Red Hat Enterprise Linux 6 (PV)                                                              | ACTIVE |                                      |
| 677c4e59-fd0e-4f11-a330-8c25750e2ad7 | Red Hat Enterprise Linux 6 (PVHVM)                                                           | ACTIVE |                                      |
| 58bd5138-5802-4d00-8a81-c7b984cce2a8 | Red Hat Enterprise Linux 7 (PVHVM)                                                           | ACTIVE |                                      |
| 940b324e-79b7-4918-aaaa-66e57de4c6ea | Scientific Linux 6 (PVHVM)                                                                   | ACTIVE |                                      |
| e8decd12-791c-442b-a611-5d28e0af754b | Scientific Linux 7 (PVHVM)                                                                   | ACTIVE |                                      |
| 1780212e-3e67-4fc4-bddb-31deaeb90101 | Ubuntu 10.04 LTS (Lucid Lynx) (PV)                                                           | ACTIVE |                                      |
| 71893ec7-b625-44a5-b333-ca19885b941d | Ubuntu 12.04 LTS (Precise Pangolin) (PV)                                                     | ACTIVE |                                      |
| 1126e296-0423-46ce-b711-2701d89bf8a9 | Ubuntu 12.04 LTS (Precise Pangolin) (PVHVM)                                                  | ACTIVE |                                      |
| 28d39e78-a41c-4fd2-80b4-dc960c055074 | Ubuntu 14.04 LTS (Trusty Tahr) (PV)                                                          | ACTIVE |                                      |
| a1558fdc-3182-4a0f-b48a-aa900a5826c3 | Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)                                                       | ACTIVE |                                      |
| 3beb44aa-a77b-48eb-be56-ccccb38a6f3f | Ubuntu 14.10 (Utopic Unicorn) (PV)                                                           | ACTIVE |                                      |
| 5e919b80-e803-45bf-a66f-73fcdc3b8de2 | Ubuntu 14.10 (Utopic Unicorn) (PVHVM)                                                        | ACTIVE |                                      |
| ab66cb4a-ff11-4c5d-b08c-b3c134654bca | Vyatta Network OS 6.7R4                                                                      | ACTIVE |                                      |
| de700a1a-d13f-4ef9-a055-9b6f09c2875c | Windows Server 2008 R2 SP1                                                                   | ACTIVE |                                      |
| f46e9237-9971-44b1-b92f-3a5a03592d3e | Windows Server 2008 R2 SP1 (base install without updates)                                    | ACTIVE |                                      |
| 50854a1d-d130-4083-ac69-a75616dcf21e | Windows Server 2008 R2 SP1 + SQL Server 2008 R2 SP2 Standard                                 | ACTIVE |                                      |
| 6e290727-d5c3-4286-8a91-82a84f69f120 | Windows Server 2008 R2 SP1 + SQL Server 2008 R2 SP2 Web                                      | ACTIVE |                                      |
| b41c2705-f820-4b6f-8d32-d04b5f57a4f7 | Windows Server 2008 R2 SP1 + SQL Server 2012 SP1 Standard                                    | ACTIVE |                                      |
| c6301f02-1388-4a4a-ba7c-b52e1bff7813 | Windows Server 2008 R2 SP1 + SQL Server 2012 SP1 Web                                         | ACTIVE |                                      |
| b28d7079-c4e8-41cf-94ce-9c4b57cf6f23 | Windows Server 2008 R2 SP1 + SharePoint 2010 Foundation with SQL Server 2008 R2 Express      | ACTIVE |                                      |
| 959aee20-e0b8-42a7-9201-10057c2b7e05 | Windows Server 2008 R2 SP1 + SharePoint 2010 Foundation with SQL Server 2008 R2 SP1 Standard | ACTIVE |                                      |
| 78cc6fbe-ad59-4324-8712-5dd191cb6a5c | Windows Server 2012                                                                          | ACTIVE |                                      |
| c81a65a3-8217-4520-96de-1d9313ae3094 | Windows Server 2012 (base install without updates)                                           | ACTIVE |                                      |
| 25f64fd5-4d61-4d4a-8cdb-801de7d9d99b | Windows Server 2012 + SQL Server 2012 SP1 Standard                                           | ACTIVE |                                      |
| 06f917b0-9c0f-4634-8190-e43630bb3468 | Windows Server 2012 + SQL Server 2012 SP1 Web                                                | ACTIVE |                                      |
| d69d55ef-cb4c-4787-9f1b-2de41ecac9a1 | Windows Server 2012 + SharePoint 2013 with SQL Server 2012 SP1 Standard                      | ACTIVE |                                      |
| 66555a30-c336-47d9-aaee-08b4390c889d | Windows Server 2012 R2                                                                       | ACTIVE |                                      |
| fe486888-6890-47ac-a02d-b740868f143b | Windows Server 2012 R2 (base install without updates)                                        | ACTIVE |                                      |
| aec8fde6-1ba8-419d-a36c-8051e0d527f7 | Windows Server 2012 R2 + SQL Server 2014 Standard                                            | ACTIVE |                                      |
| e7c596c6-7049-4d00-94e7-c735d3b9f976 | Windows Server 2012 R2 + SQL Server 2014 Web                                                 | ACTIVE |                                      |
| 9aa0d346-c06f-4652-bbb1-4342a7d2d017 | iPXE Boot (boot.rackspace.com)                                                               | ACTIVE |                                      |
+--------------------------------------+----------------------------------------------------------------------------------------------+--------+--------------------------------------+

In this example I’m going with Ubuntu 14.04 Long Term Support (LTS). You might want to make a note of the image ID you intend to use.

Obviously using a Windows or Red Hat image has cost implications.

+--------------------------------------+----------------------------------------------------------------------------------------------+--------+--------------------------------------+
| ID                                   | Name                                                                                         | Status | Server                               |
+--------------------------------------+----------------------------------------------------------------------------------------------+--------+--------------------------------------+
| a1558fdc-3182-4a0f-b48a-aa900a5826c3 | Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)                                                       | ACTIVE |                                      |
+--------------------------------------+----------------------------------------------------------------------------------------------+--------+--------------------------------------+

Choose a Flavour

You also need to decide what kind of virtual server you need. Obviously this has cost implications too.

$ nova flavor-list
+------------------+-------------------------+-----------+------+-----------+------+-------+-------------+-----------+
| ID               | Name                    | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+------------------+-------------------------+-----------+------+-----------+------+-------+-------------+-----------+
| 2                | 512MB Standard Instance | 512       | 20   | 0         | 512  | 1     | 80.0        | N/A       |
| 3                | 1GB Standard Instance   | 1024      | 40   | 0         | 1024 | 1     | 120.0       | N/A       |
| 4                | 2GB Standard Instance   | 2048      | 80   | 0         | 2048 | 2     | 240.0       | N/A       |
| 5                | 4GB Standard Instance   | 4096      | 160  | 0         | 2048 | 2     | 400.0       | N/A       |
| 6                | 8GB Standard Instance   | 8192      | 320  | 0         | 2048 | 4     | 600.0       | N/A       |
| 7                | 15GB Standard Instance  | 15360     | 620  | 0         | 2048 | 6     | 800.0       | N/A       |
| 8                | 30GB Standard Instance  | 30720     | 1200 | 0         | 2048 | 8     | 1200.0      | N/A       |
| general1-1       | 1 GB General Purpose v1 | 1024      | 20   | 0         |      | 1     | 200.0       | N/A       |
| general1-2       | 2 GB General Purpose v1 | 2048      | 40   | 0         |      | 2     | 400.0       | N/A       |
| general1-4       | 4 GB General Purpose v1 | 4096      | 80   | 0         |      | 4     | 800.0       | N/A       |
| general1-8       | 8 GB General Purpose v1 | 8192      | 160  | 0         |      | 8     | 1600.0      | N/A       |
| io1-120          | 120 GB I/O v1           | 122880    | 40   | 1200      |      | 32    | 10000.0     | N/A       |
| io1-15           | 15 GB I/O v1            | 15360     | 40   | 150       |      | 4     | 1250.0      | N/A       |
| io1-30           | 30 GB I/O v1            | 30720     | 40   | 300       |      | 8     | 2500.0      | N/A       |
| io1-60           | 60 GB I/O v1            | 61440     | 40   | 600       |      | 16    | 5000.0      | N/A       |
| io1-90           | 90 GB I/O v1            | 92160     | 40   | 900       |      | 24    | 7500.0      | N/A       |
| performance1-1   | 1 GB Performance        | 1024      | 20   | 0         |      | 1     | 200.0       | N/A       |
| performance1-2   | 2 GB Performance        | 2048      | 40   | 20        |      | 2     | 400.0       | N/A       |
| performance1-4   | 4 GB Performance        | 4096      | 40   | 40        |      | 4     | 800.0       | N/A       |
| performance1-8   | 8 GB Performance        | 8192      | 40   | 80        |      | 8     | 1600.0      | N/A       |
| performance2-120 | 120 GB Performance      | 122880    | 40   | 1200      |      | 32    | 10000.0     | N/A       |
| performance2-15  | 15 GB Performance       | 15360     | 40   | 150       |      | 4     | 1250.0      | N/A       |
| performance2-30  | 30 GB Performance       | 30720     | 40   | 300       |      | 8     | 2500.0      | N/A       |
| performance2-60  | 60 GB Performance       | 61440     | 40   | 600       |      | 16    | 5000.0      | N/A       |
| performance2-90  | 90 GB Performance       | 92160     | 40   | 900       |      | 24    | 7500.0      | N/A       |
+------------------+-------------------------+-----------+------+-----------+------+-------+-------------+-----------+

Here I’m going for the 512MB Standard Instance. Note, the image ID here is 2.

+------------------+-------------------------+-----------+------+-----------+------+-------+-------------+-----------+
| ID               | Name                    | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+------------------+-------------------------+-----------+------+-----------+------+-------+-------------+-----------+
| 2                | 512MB Standard Instance | 512       | 20   | 0         | 512  | 1     | 80.0        | N/A       |
+------------------+-------------------------+-----------+------+-----------+------+-------+-------------+-----------+

Spin-up the Server

To create a server, you use nova’s boot command with the following arguments.

nova boot --flavor <Flavor ID> --image <Image ID> <Server Name>

For example, to create a server using my image and flavour selections above, called “DummyDomains”, use the command below.

$ nova boot --flavor 2 --image a1558fdc-3182-4a0f-b48a-aa900a5826c3 DummyDomains
+--------------------------------------+-------------------------------------------------------------------------------+
| Property                             | Value                                                                         |
+--------------------------------------+-------------------------------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                                                        |
| OS-EXT-STS:power_state               | 0                                                                             |
| OS-EXT-STS:task_state                | -                                                                             |
| OS-EXT-STS:vm_state                  | building                                                                      |
| RAX-PUBLIC-IP-ZONE-ID:publicIPZoneId | 41589a287f0d2417cf04cc3bdaeb992448f56708020de3b30dcd5558                      |
| accessIPv4                           |                                                                               |
| accessIPv6                           |                                                                               |
| adminPass                            | EPxHe8go3dC3                                                                  |
| flavor                               | 512MB Standard Instance (2)                                                   |
| id                                   | 128daa81-6f7e-44f8-bb8d-7a215b380535                                          |
| image                                | Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM) (a1558fdc-3182-4a0f-b48a-aa900a5826c3) |
| metadata                             | {}                                                                            |
| name                                 | DummyDomains                                                                  |
| progress                             | 0                                                                             |
| status                               | BUILD                                                                         |
+--------------------------------------+-------------------------------------------------------------------------------+

You should see some output similar to the above. You can also see information about the new instance with the below command.

$ nova list --status build
+--------------------------------------+--------------+--------+------------+-------------+--------------------------------------------------------------------------------------+
| ID                                   | Name         | Status | Task State | Power State | Networks                                                                             |
+--------------------------------------+--------------+--------+------------+-------------+--------------------------------------------------------------------------------------+
| 128daa81-6f7e-44f8-bb8d-7a215b380535 | DummyDomains | BUILD  | spawning   | NOSTATE     | public=162.13.12.107, 2a00:1a48:7806:114:be76:4eff:fe08:1583; private=10.179.128.178 |
+--------------------------------------+--------------+--------+------------+-------------+--------------------------------------------------------------------------------------+

Snapshots

Snapshots are bootable and allow you to take a bit-for-bit image of your existing server. This allows you to delete a server and then at a later date, recreate it using a previously saved image. This is also a convenient ways to manage Virtual Machine upgrades.

Create Snapshot Image

You create a snapshot using nova’s image-create subcommand as shown below.

$ nova image-create DummyDomains DummyDomainsSnapshot

Delete a Saved Snapshot Image

You can delete a saved image with the image-delete subcommand.

$ nova image-delete DummyDomainsSnapshot

Delete a Cloud Server

Finally, you might well want to delete a cloud server. That can be achieved with.

$ nova delete DummyDomains
Request to delete server DummyDomains has been accepted.

Don’t forget you can always create a new server instance from an existing saving snapshot image. Just make sure you use the correct image ID.

Related Documents

Useful python-novaclient commands

Be the first to comment

Leave a Reply