Openstack instance management using CLI

Dear friends today we will see, how to manage instance using CLI in openstack. Such as how to start, stop, suspend, resume, reboot and rescue instance. Suppose if our instance operating system has some problem and we need to go to rescue mode to debug some think, then we need to go to rescue mode in our instance.

We will see such types of commands in this tutorial with example. So that you can easily manager your instance using CLI commands. Once you need to manage your instance using CLI. So let’s start one by one command with example.

How to get instance list?

We can use nova list commands to display all our instance. You can also use grep commands to display selected instance. Like below output. I am selecting my cirros instance using nova list |grep instance commands.

#Command:-nova list |grep <instance-name>
[email protected]:~$ nova list |grep cirros
| 5aa3612d-9f25-4777-9275-2ff6900a8496 | cirros       | ACTIVE | -          | Running     | provider=172.21.144.217                                                    |
[email protected]:~$

How to pause instance?

We can use nova pause commands to pause instance in openstack. You can see below nova pause command output.

#Command:-nova pause <instance-name>
[email protected]:~$ nova pause cirros
[email protected]:~$
[email protected]:~$ nova list |grep cirros
| 5aa3612d-9f25-4777-9275-2ff6900a8496 | cirros       | PAUSED | -          | Paused      | provider=172.21.144.217                                                    |
[email protected]:~$

How to unpause instance?

We can unpause instance using nova unpause commands. You can see nova unpause commands output.

[email protected]:~$ nova unpause cirros
[email protected]:~$ nova list |grep cirros
| 5aa3612d-9f25-4777-9275-2ff6900a8496 | cirros       | ACTIVE | -          | Running     | provider=172.21.144.217                                                    |
[email protected]:~$

How to suspend instance?

We can suspend instance using nova suspend commands. You can see below output of suspend commands.

#Command:-nova suspend <instance-name>
[email protected]:~$ nova suspend cirros
[email protected]:~$ nova list |grep cirros
| 5aa3612d-9f25-4777-9275-2ff6900a8496 | cirros       | SUSPENDED | -          | Shutdown    | provider=172.21.144.217                                                    |
[email protected]:~$

How to unsuspend instance?

We can unsuspend instance using nova resume commands. You can see below output of resume commands.

#Command:-nova rescue <instance-name>
[email protected]:~$ nova resume cirros
[email protected]:~$ nova list |grep cirros
| 5aa3612d-9f25-4777-9275-2ff6900a8496 | cirros       | ACTIVE | -          | Running     | provider=172.21.144.217                                                    |
[email protected]:~$

How to stop instance?

We can shutdown instance using nova stop commands. You can see nova stop commands output in below output.

#Command:-nova stop <instance-name>
[email protected]:~$ nova stop cirros

Request to stop server cirros has been accepted.

How to start instance?

We can start instance using nova start commands. You can see below nova start commands output.

#Command:-nova start <instance-name>

[email protected]:~$ nova start cirros
Request to start server cirros has been accepted.
[email protected]:~$ nova list |grep cirros
| 5aa3612d-9f25-4777-9275-2ff6900a8496 | cirros       | ACTIVE | -          | Running     | provider=172.21.144.217                                                    |
[email protected]:~$

How to go to rescue mode in instance?

Some time we need to go to rescue mode for debugging in instance. In this case we can use nova rescue mode to go to rescue mode in instance. You can see output of nova rescue commands.

#Command:-nova rescue <instance-name>
[email protected]:~$ nova rescue cirros
+-----------+--------------+
| Property  | Value        |
+-----------+--------------+
| adminPass | mPDTzj39vWiB |
+-----------+--------------+
[email protected]:~$ nova list |grep cirros
| 5aa3612d-9f25-4777-9275-2ff6900a8496 | cirros       | RESCUE | -          | Running     | provider=172.21.144.217                                                    |
[email protected]:~$

You can see in above output we have successfully entered in rescue mode in cirros instance.

How to remove rescue mode?

We can move out from rescue mode using nova unrescue commands once our debugging will be completed. You can see output of unrescue commands.

#Command:-nova unrescue <instance-name>
[email protected]:~$ nova unrescue cirros
[email protected]:~$ nova list |grep cirros
| 5aa3612d-9f25-4777-9275-2ff6900a8496 | cirros       | ACTIVE | -          | Running     | provider=172.21.144.217                                                    |
[email protected]:~$

How to reboot instance?

We can reboot our instance using nova reboot commands. You can see nova reboot output commands in below.

#Command:-nova reboot <instance-name>
[email protected]:~$ nova reboot cirros
Request to reboot server <Server: cirros> has been accepted.
[email protected]:~$ nova list |grep cirros
| 5aa3612d-9f25-4777-9275-2ff6900a8496 | cirros       | ACTIVE | -          | Running     | provider=172.21.144.217                                                    |
[email protected]:~$

That’s all we have seen some cli commands to manage instance in openstack in this tutorial.

1 thought on “Openstack instance management using CLI

  1. Good day.
    Can anyone tell me why I do not get a “Request to stop server has been accepted/” message when I issue the “nova stop ” command?

    Regards,
    Bjoern

Leave a Reply

Your email address will not be published. Required fields are marked *