【教程】openstack删除僵尸实例

openstack安装完毕测试过程中,由于一些原因导致实例创建失败,即使问题修复后,通过nova delete id删除实例,其实实例还存在于数据库重,此时需要通过sql语句进行删除。

这种实例叫做僵尸实例

[root@controllerv3 ~]# mysql -p密码
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 160
Server version: 10.3.20-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use nova;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [nova]> select id,display_name,uuid from instances;
+----+--------------+--------------------------------------+
| id | display_name | uuid                                 |
+----+--------------+--------------------------------------+
|  1 | vm1          | b895b348-9538-47bc-9fd1-e78ee3fb8b13 | |
+----+--------------+--------------------------------------+
9 rows in set (0.001 sec)

MariaDB [nova]> SET FOREIGN_KEY_CHECKS=0;
Query OK, 0 rows affected (0.000 sec)

MariaDB [nova]> delete from instances where id='b895b348-9538-47bc-9fd1-e78ee3fb8b13;
Query OK, 1 rows affected, 2 warnings (0.133 sec)

MariaDB [nova]> select id,display_name,uuid from instances;
Empty set (0.001 sec)

MariaDB [nova]> SET FOREIGN_KEY_CHECKS=1;
Query OK, 0 rows affected (0.000 sec)

MariaDB [nova]> Ctrl-C -- exit!
Aborted
posted @ 2022-03-18 21:00  小拳头呀  阅读(277)  评论(0编辑  收藏  举报