TAGS

There are no tags associated with this article.

How to correctly delete all the resources in the project via OpenStack command-line Clients?

If you are not going to use the resources in your projects anymore, please delete them to stop charging them by the billing system.

Please do not delete a project before deleting all the containing resources. Deleting the project before deleting the containing resuorces makes them orphaned.

 Log in to Cloud Dashboard (https://cf2.cloudferro.com) and from the drop-down menu select the project.

Then prepare the command line environment as per one of this articles: https://creodias.eu/-/how-to-install-openstackclient-linux-? or https://creodias.eu/-/how-to-install-openstackclient-windows-gitbash-cygwin?

 

In the next step run the downloaded script using command 'source'.

When you are prompted for an OpenStack Password, enter the password used for logging to OpenStack Dashboard.

$ source test-openrc.sh
Please enter your Openstack Password for project test as user test@cloudferro.com:

 

Now you are able to list all the resources in the project by entering  commands below.

$ echo Servers: && openstack server list && echo Volumes: && openstack volume list && echo Volume Snapshots:\
> && openstack volume snapshot list && echo Floating ip: && openstack floating ip list && echo Routers:: && openstack router list

 

 

 To delete all the resources you have to detach volumes from servers.

$ openstack server remove volume <server_id> <volume_id>

Make sure, that your volume does not have any volume snapshots. Otherwise type command:

$ openstack delete volume snapshot <volume_snapshot_id>

Now you can delete the volume.

$ openstack delete volume <volume_id>

After that you are able to delete the server.

$ openstack server delete <server_id>

Then delete floating IP.

$ openstack delete floating ip <floating_ip_id>

Finally you can delete router:

$ openstack router show fe7987a8-284b-42c0-8734-6423d4ea6e7d -f json
{
  "admin_state_up": true,
  "availability_zone_hints": null,
  "availability_zones": null,
  "created_at": "2021-12-21T11:32:05Z",
  "description": "",
  "external_gateway_info": {
    "network_id": "31d7e67a-b30a-43f4-8b06-1667c70ba90d",
    "enable_snat": true,
    "external_fixed_ips": [
      {
        "subnet_id": "bfb8ab78-0208-4e0c-8b66-9421b70ee798",
        "ip_address": "185.52.194.29"
      }
    ]
  },
  "flavor_id": null,
  "id": "fe7987a8-284b-42c0-8734-6423d4ea6e7d",
  "interfaces_info": [
    {
      "port_id": "b1a0e2f3-ec61-4b78-9370-185f756d0532",
      "ip_address": "192.168.2.1",
      "subnet_id": "f0d6a482-5bfa-403f-bbf1-793877a86c82"
    }
  ],
  "name": "test",
  "project_id": "cd0aacee9d3549e89ebbf68202c92c37",
  "revision_number": 3,
  "routes": [],
  "status": "ACTIVE",
  "tags": [],
  "updated_at": "2021-12-21T11:32:31Z"
}
$ openstack router remove port <router_id> <port_id>
$ openstack router remove subnet <router_id> <subnet_id>
$ openstack router delete <router_id>

 

 After having deleted all the resources go to Cloud Dashboard, select Identity → Projects. Mark the project that you want to delete and from the drop-down menu select "Delete Project".