From time to time, especially during testing and automated script tenant deployment, my OpenStack cloud installation gets disordered. Situations when I am unable to delete neutron port in Horizon dashboard are pretty common phenomenon, this most likely leads to problem with deleting network which the problematic port belongs to.
In such cases we may need to edit OpenStack database, which is MariaDB, and manually delete orphaned neutron port related record from MariaDB ports table.
Steps to remove blocked neutron port:
1. Source admin keystone file on controller node
[root@controller ~]# source /root/keystonerc_admin
2. Verify once again orphaned neutron port using OpenStack CLI commands
[root@controller ~(keystone_admin)]# neutron port-list | grep d06e19fc-c637-402b-85a2-3519c69a1035
3. Log in to Openstack MariaDB database on Controller node
[root@controller ~(keystone_admin)]# mysql -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 160448 Server version: 5.5.40-MariaDB-wsrep MariaDB Server, wsrep_25.11.r4026 Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
4. Switch to neutron database
MariaDB [(none)]> use neutron;
5. Delete orphaned port from ports table
MariaDB [neutron]> delete from ports where id='d06e19fc-c637-402b-85a2-3519c69a1035';
That’s it, neutron port has been deleted, you can now delete the blocked network, which the orphaned port belonged to.