Instance: delete

If you would like to delete one of the VMs, you have created, you can follow the steps below or follow the Deletion tutorial in Tutorials for OpenStack dashboard.

Warning

The order of the steps is important to avoid errors during the deletion.

  • In the Horizon Dashboard, select on “Network → Floating IPs”, then click on the button “Disassociate” on the right side of the dashboard page for the IP associated to your VM. If desired, you can also release the floating IP.

Note

Once you release it, there is no guarantee the same IP can be allocated again.

  • Go to “Compute → Instances”, and display the drop-down menu of the VM you want to delete and then click the action “Delete Instance”

  • List all the VMs in the tenant

openstack server list
+----------------+------------------+--------+-------------------------------------------------------------+--------------+---------------+
| ID             | Name             | Status | Networks                                                    | Image        | Flavor        |
+----------------+------------------+--------+-------------------------------------------------------------+--------------+---------------+
| <Server-ID-01> | <Server-01-Name> | ACTIVE | <Network-Name>=<Floating-IP-Address-01>,<Fixed-IP-Address> ... | <Image-Name> | <Flavor-Name> |
| <Server-ID-02> | <Server-02-Name> | ACTIVE | <Network-Name>=<Floating-IP-Address-02>,<Fixed-IP-Address> ... | <Image-Name> | <Flavor-Name> |
...
| <Server-ID-XX> | <Server-XX-Name> | ACTIVE | <Network-Name>=<Floating-IP-Address-XX>,<Fixed-IP-Address> ... | <Image-Name> | <Flavor-Name> |
+--------------------------------------+------+--------+-----------------------------------------+------------------------+---------------+
  • Shut down the VM using its ID from the previous step

openstack server stop <Server-ID-XX>
  • Find the ID of the Floating IP associated to the VM based using the VM Floating IP Address

openstack floating ip list --floating-ip-address <Floating-IP-Address>
+------------------+-----------------------+--------------------+-----------+-----------------------+--------------+
| ID               | Floating IP Address   | Fixed IP Address   | Port      | Floating Network      | Project      |
+------------------+-----------------------+--------------------+-----------+-----------------------+--------------+
| <Floating-IP-ID> | <Floating-IP-Address> | <Fixed-IP-Address> | <Port-ID> | <Floating-Network-ID> | <Project-ID> |
+------------------+-----------------------+--------------------+-----------+-----------------------+--------------+
  • Disassociate the Floating IP

openstack floating ip unset <Floating-IP-ID>

Note

Once you release it, there is no guarantee the same IP can be allocated again.

  • Delete the VM

openstack server delete <Server-ID-XX>

If you are deleting the VM because of issues, and you would like to recreate it in a clean environment, it is recommended to remove also the network resources (router, interfaces, etc) that were associated to your instance. For this follow Deletion tutorial in Tutorials for OpenStack dashboard.