OpenStack 删除无用的计算结点(2)

mysql> delete from compute_nodes where service_id=6;
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`nova`.`compute_node_stats`,
CONSTRAINT `fk_compute_node_stats_compute_node_id` FOREIGN KEY (`compute_node_id`) REFERENCES `compute_nodes` (`id`))

有外键依赖,同时在另外一张表删除相关行

mysql> delete from compute_node_stats where compute_node_id=1;
Query OK, 18 rows affected (0.01 sec)

mysql> delete from compute_nodes where service_id=6;
Query OK, 1 row affected (0.00 sec)

mysql> delete from services where id=6;
Query OK, 5 rows affected (0.03 sec)

搞掂:

[root@yanheven-001 ~(keystone_admin)]# nova service-list
+------------------+---------------------------+----------+----------+-------+----------------------------+-----------------+
| Binary          | Host                      | Zone    | Status  | State | Updated_at                | Disabled Reason |
+------------------+---------------------------+----------+----------+-------+----------------------------+-----------------+
| nova-consoleauth | yanheven-001.yanheven.tk | internal | enabled  | up    | 2014-05-09T01:51:37.000000 | None            |
| nova-scheduler  | yanheven-001.yanheven.tk | internal | enabled  | up    | 2014-05-09T01:51:39.000000 | None            |
| nova-conductor  | yanheven-001.yanheven.tk | internal | enabled  | up    | 2014-05-09T01:51:41.000000 | None            |
| nova-cert        | yanheven-001.yanheven.tk | internal | enabled  | up    | 2014-05-09T01:51:38.000000 | None            |
| nova-compute    | yanheven-012.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:36.000000 | None            |
| nova-compute    | yanheven-013.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:42.000000 | None            |
| nova-compute    | yanheven-014.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:40.000000 | None            |
| nova-compute    | yanheven-015.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:41.000000 | None            |
| nova-compute    | yanheven-017.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:36.000000 | None            |
| nova-compute    | yanheven-018.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:37.000000 | None            |
| nova-compute    | yanheven-032.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:41.000000 | None            |
| nova-compute    | yanheven-031.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:32.000000 | None            |
| nova-compute    | yanheven-034.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:34.000000 | None            |
| nova-compute    | yanheven-029.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:42.000000 | None            |
| nova-compute    | yanheven-028.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:39.000000 | None            |
| nova-compute    | yanheven-036.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:39.000000 | None            |
| nova-compute    | yanheven-033.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:41.000000 | None            |
| nova-compute    | yanheven-030.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:34.000000 | None            |
| nova-compute    | yanheven-016.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:42.000000 | None            |
| nova-compute    | yanheven-035.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:39.000000 | None            |
| nova-compute    | yanheven-027.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:41.000000 | None            |
| nova-compute    | yanheven-026.yanheven.tk | nova    | enabled  | up    | 2014-05-09T01:51:34.000000 | None            |
+------------------+---------------------------+----------+----------+-------+----------------------------+-----------------+

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/3fc7a6cdecb7361a4a651e995eefafa2.html