Openstack instance management using CLI

Dear friends today we will see, Openstack instance management using CLI. Like: – How to start, stop, suspend, resume, reboot and rescue instance in OpenStack. Suppose if our instance operating system has some problem and we need to go to rescue mode to debug something, then we need to go to rescue mode in our instance.

Openstack instance management using CLI

We will see such types of commands in this tutorial with example. So that you can easily manage 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 OpenStack 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.

Openstack instance management

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>
test@urclouds:~$ nova pause cirros
test@urclouds:~$
test@urclouds:~$ nova list |grep cirros
| 5aa3612d-9f25-4777-9275-2ff6900a8496 | cirros       | PAUSED | -          | Paused      | provider=172.21.144.217                                                    |
test@urclouds:~$

How to unpause instance?

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

test@urclouds:~$ nova unpause cirros
test@urclouds:~$ nova list |grep cirros
| 5aa3612d-9f25-4777-9275-2ff6900a8496 | cirros       | ACTIVE | -          | Running     | provider=172.21.144.217                                                    |
test@urclouds:~$

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>
test@urclouds:~$ nova suspend cirros
test@urclouds:~$ nova list |grep cirros
| 5aa3612d-9f25-4777-9275-2ff6900a8496 | cirros       | SUSPENDED | -          | Shutdown    | provider=172.21.144.217                                                    |
test@urclouds:~$

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>
test@urclouds:~$ nova resume cirros
test@urclouds:~$ nova list |grep cirros
| 5aa3612d-9f25-4777-9275-2ff6900a8496 | cirros       | ACTIVE | -          | Running     | provider=172.21.144.217                                                    |
test@urclouds:~$

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>
test@urclouds:~$ 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>

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

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>
test@urclouds:~$ nova rescue cirros
+-----------+--------------+
| Property  | Value        |
+-----------+--------------+
| adminPass | mPDTzj39vWiB |
+-----------+--------------+
test@urclouds:~$ nova list |grep cirros
| 5aa3612d-9f25-4777-9275-2ff6900a8496 | cirros       | RESCUE | -          | Running     | provider=172.21.144.217                                                    |
test@urclouds:~$

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>
test@urclouds:~$ nova unrescue cirros
test@urclouds:~$ nova list |grep cirros
| 5aa3612d-9f25-4777-9275-2ff6900a8496 | cirros       | ACTIVE | -          | Running     | provider=172.21.144.217                                                    |
test@urclouds:~$

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>
test@urclouds:~$ nova reboot cirros
Request to reboot server <Server: cirros> has been accepted.
test@urclouds:~$ nova list |grep cirros
| 5aa3612d-9f25-4777-9275-2ff6900a8496 | cirros       | ACTIVE | -          | Running     | provider=172.21.144.217                                                    |
test@urclouds:~$

For more details about how to manage openstack instance you can Click-Here

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

You can also check this below link if you want to live migrate your instance from one host to anther host.

Instance Live Migration in OpenStack using CLI

Leave a Reply