Nova: Getting Started with the Openstack CLI

NovaFig2Looking to get started with the nova command, well look no further. Here are a few simple commands that you can use to get started. Nothing fancy here, rather these commands serve as a basic introduction to nova command and the OpenStack CLI.

Note that the following commands are all run on a standalone OpenStack install deployed via the PackStack installer. Not that this matters all that much, but it will explain the hostname of my controller/compute node.

List all uploaded images. Here you can see that I only have one active image available via Glance.

[root@packstack ~(keystone_admin)]# nova image-list
+————————————–+————–+——–+——–+
| ID                                                                 | Name          | Status | Server |
+————————————–+————–+——–+——–+
| b60448e9-48b8-4727-9cb8-415662ec3bf8 | Cirros-0.3.3 | ACTIVE | |
+————————————–+————–+——–+——–+

Show detailed information pertaining to a specific image.

In this instance I am using the ID from the entry above.

[root@packstack ~(keystone_admin)]#  nova image-show b60448e9-48b8-4727-9cb8-415662ec3bf8

+———————-+————————————–+
| Property                          | Value |
+———————-+————————————–+
| OS-EXT-IMG-SIZE:size | 13200896 |
| created | 2015-04-14T22:02:17Z |
| id | b60448e9-48b8-4727-9cb8-415662ec3bf8 |
| minDisk | 0 |
| minRam | 0 |
| name | Cirros-0.3.3 |
| progress | 100 |
| status | ACTIVE |
| updated | 2015-04-14T22:02:18Z |
+———————-+————————————–+

List all hypervisors in an OpenStack Cluster…

[root@packstack ~(keystone_admin)]# nova hypervisor-list
+—-+———————+
| ID | Hypervisor hostname |
+—-+———————+
| 1   | packstack.local |
+—-+———————+

List all Flavors...

[root@packstack ~(keystone_admin)]# nova flavor-list
+—-+———–+———–+——+———–+——+——-+————-+———–+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+—-+———–+———–+——+———–+——+——-+————-+———–+
| 1 | m1.tiny | 512 | 1 | 0 | | 1 | 1.0 | True |
| 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True |
| 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True |
| 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True |
| 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True |
+—-+———–+———–+——+———–+——+——-+————-+———–+

Show additional information pertaining to a specific flavor.

root@packstack ~(keystone_admin)]# nova flavor-show m1.tiny

+—————————-+———+
| Property | Value |
+—————————-+———+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| disk | 1 |
| extra_specs | {} |
| id | 1 |
| name | m1.tiny |
| os-flavor-access:is_public | True |
| ram | 512 |
| rxtx_factor | 1.0 |
| swap | |
| vcpus | 1 |
+—————————-+———+

List all running instances, regardless of tenant.

Here you can see both the private ip address, and the public, floating ip address of each instance.

[root@packstack ~(keystone_admin)]# nova list –all_tenants
+————————————–+———–+——–+————+————-+————————————-+
| ID | Name | Status | Task State | Power State | Networks |
+————————————–+———–+——–+————+————-+————————————-+
| 473170c0-c7b5-4da7-909a-682b14bba1ae | instance1 | ACTIVE | – | Running | Private=172.16.0.2, 192.168.122.201 |
| 3c25fa8a-0476-40fd-9b27-f4c0c7082dc1 | instance2 | ACTIVE | – | Running | Private=172.16.0.4, 192.168.122.202 |
+————————————–+———–+——–+————+————-+————————————-+

Get detailed information on running instances.

Note that this output is a bit ugly below. It will look better on your console.

[root@packstack ~(keystone_admin)]# nova-manage vm list
instance node type state launched image kernel ramdisk project user zone index
instance1 packstack.local m1.tiny active 2015-04-14 22:08:24 b60448e9-48b8-4727-9cb8-415662ec3bf8 0254b6c215de43e697256fa27bcd3477 a2be9c15f7cd49a3afbfae3963cf0553 nova 0
instance2 packstack.local m1.tiny active 2015-04-27 22:33:50 b60448e9-48b8-4727-9cb8-415662ec3bf8 0254b6c215de43e697256fa27bcd3477 a2be9c15f7cd49a3afbfae3963cf0553 nova 0

For more information — take a look here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s