查看openstack集群的服务列表

[root@os-node1 ~]# nova service-list

+------------------+----------+----------+---------+-------+----------------------------+-----------------+

| Binary           | Host     | Zone     | Status  | State | Updated_at                 | Disabled Reason |

+------------------+----------+----------+---------+-------+----------------------------+-----------------+

| nova-cert        | os-node1 | internal | enabled | up    | 2014-08-03T15:35:02.000000 | -               |

| nova-consoleauth | os-node1 | internal | enabled | up    | 2014-08-03T15:35:05.000000 | -               |

| nova-conductor   | os-node1 | internal | enabled | up    | 2014-08-03T15:35:02.000000 | -               |

| nova-scheduler   | os-node1 | internal | enabled | up    | 2014-08-03T15:35:07.000000 | -               |

| nova-compute     | os-node3 | nova     | enabled | down  | 2014-08-02T17:18:04.000000 | -               |

| nova-compute     | os-node4 | nova     | enabled | down  | 2014-08-02T17:18:16.000000 | -               |

| nova-cells       | os-node1 | internal | enabled | up    | 2014-08-03T15:35:00.000000 | -               |

| nova-console     | os-node1 | internal | enabled | up    | 2014-08-03T15:35:02.000000 | -               |

| nova-compute     | os-node5 | nova     | enabled | up    | 2014-08-03T15:35:09.000000 | -               |

| nova-compute     | os-node6 | nova     | enabled | up    | 2014-08-03T15:35:00.000000 | -               |

+------------------+----------+----------+---------+-------+----------------------------+-----------------+

查看发现os-node3 down了 如果确认此计算节点可以删除需要在控制器的数据库中进行下面操作

查看compute_nodes数据库表发现os-node3的id为1,service_id为5.

mysql> select * from compute_nodes;

+---------------------+---------------------+------------+----+------------+-------+-----------+----------+------------+----------------+---------------+-----------------+--------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+-------------+--------------+------------------+-------------+---------------------+---------+-------------+--------------------------------------------------------------------------------------------------------+-----------+

| created_at          | updated_at          | deleted_at | id | service_id | vcpus | memory_mb | local_gb | vcpus_used | memory_mb_used | local_gb_used | hypervisor_type | hypervisor_version | cpu_info                                                                                                                                                                                                                                                                                        | disk_available_least | free_ram_mb | free_disk_gb | current_workload | running_vms | hypervisor_hostname | deleted | host_ip     | supported_instances                                                                                    | pci_stats |

+---------------------+---------------------+------------+----+------------+-------+-----------+----------+------------+----------------+---------------+-----------------+--------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+-------------+--------------+------------------+-------------+---------------------+---------+-------------+--------------------------------------------------------------------------------------------------------+-----------+

| 2014-07-29 19:34:06 | 2014-08-02 17:18:06 | NULL       |  1 |          5 |    24 |    129217 |       95 |          0 |            512 |             0 | QEMU            |              12001 | {"vendor": "Intel", "model": "SandyBridge", "arch": "x86_64", "features": ["pdpe1gb", "osxsave", "dca", "pcid", "pdcm", "xtpr", "tm2", "est", "smx", "vmx", "ds_cpl", "monitor", "dtes64", "pbe", "tm", "ht", "ss", "acpi", "ds", "vme"], "topology": {"cores": 6, "threads": 2, "sockets": 1}} |                   23 |      128705 |           95 |                0 |           0 | os-node3            |       0 | 10.40.10.66 | [["i686", "qemu", "hvm"], ["i686", "kvm", "hvm"], ["x86_64", "qemu", "hvm"], ["x86_64", "kvm", "hvm"]] | []        |

| 2014-07-29 19:34:37 | 2014-08-02 17:17:38 | NULL       |  2 |          6 |    24 |    129015 |      672 |         56 |          80512 |          1700 | QEMU            |              12001 | {"vendor": "Intel", "model": "SandyBridge", "arch": "x86_64", "features": ["pdpe1gb", "osxsave", "dca", "pcid", "pdcm", "xtpr", "tm2", "est", "smx", "vmx", "ds_cpl", "monitor", "dtes64", "pbe", "tm", "ht", "ss", "acpi", "ds", "vme"], "topology": {"cores": 6, "threads": 2, "sockets": 1}} |                 -527 |       48503 |        -1028 |                0 |           9 | os-node4            |       0 | 10.40.10.67 | [["i686", "qemu", "hvm"], ["i686", "kvm", "hvm"], ["x86_64", "qemu", "hvm"], ["x86_64", "kvm", "hvm"]] | []        |

| 2014-08-01 06:22:07 | 2014-08-03 15:23:53 | NULL       |  3 |          9 |    24 |     64575 |      487 |         20 |          32512 |           600 | QEMU            |              12001 | {"vendor": "Intel", "model": "SandyBridge", "arch": "x86_64", "features": ["pdpe1gb", "osxsave", "dca", "pcid", "pdcm", "xtpr", "tm2", "est", "smx", "vmx", "ds_cpl", "monitor", "dtes64", "pbe", "tm", "ht", "ss", "acpi", "ds", "vme"], "topology": {"cores": 6, "threads": 2, "sockets": 1}} |                  460 |       32063 |         -113 |                0 |           4 | os-node5            |       0 | 10.40.10.68 | [["i686", "qemu", "hvm"], ["i686", "kvm", "hvm"], ["x86_64", "qemu", "hvm"], ["x86_64", "kvm", "hvm"]] | []        |

| 2014-08-01 06:22:12 | 2014-08-03 15:24:39 | NULL       |  4 |         10 |    24 |     64573 |      487 |         20 |          32512 |           600 | QEMU            |              12001 | {"vendor": "Intel", "model": "SandyBridge", "arch": "x86_64", "features": ["pdpe1gb", "osxsave", "dca", "pcid", "pdcm", "xtpr", "tm2", "est", "smx", "vmx", "ds_cpl", "monitor", "dtes64", "pbe", "tm", "ht", "ss", "acpi", "ds", "vme"], "topology": {"cores": 6, "threads": 2, "sockets": 1}} |                  458 |       32061 |         -113 |                0 |           4 | os-node6            |       0 | 10.40.10.69 | [["i686", "qemu", "hvm"], ["i686", "kvm", "hvm"], ["x86_64", "qemu", "hvm"], ["x86_64", "kvm", "hvm"]] | []        |

+---------------------+---------------------+------------+----+------------+-------+-----------+----------+------------+----------------+---------------+-----------------+--------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+-------------+--------------+------------------+-------------+---------------------+---------+-------------+--------------------------------------------------------------------------------------------------------+-----------+

4 rows in set (0.00 sec)

查看services数据库表发现os-node3的service_id为5

mysql> select * from services;

+---------------------+---------------------+------------+----+----------+------------------+-------------+--------------+----------+---------+-----------------+

| created_at          | updated_at          | deleted_at | id | host     | binary           | topic       | report_count | disabled | deleted | disabled_reason |

+---------------------+---------------------+------------+----+----------+------------------+-------------+--------------+----------+---------+-----------------+

| 2014-07-29 18:33:46 | 2014-08-03 15:27:31 | NULL       |  1 | os-node1 | nova-cert        | cert        |        42058 |        0 |       0 | NULL            |

| 2014-07-29 18:33:46 | 2014-08-03 15:27:35 | NULL       |  2 | os-node1 | nova-consoleauth | consoleauth |        42062 |        0 |       0 | NULL            |

| 2014-07-29 18:33:46 | 2014-08-03 15:27:32 | NULL       |  3 | os-node1 | nova-conductor   | conductor   |        42059 |        0 |       0 | NULL            |

| 2014-07-29 18:33:46 | 2014-08-03 15:27:27 | NULL       |  4 | os-node1 | nova-scheduler   | scheduler   |        42058 |        0 |       0 | NULL            |

| 2014-07-29 19:34:05 | 2014-08-02 17:18:04 | NULL       |  5 | os-node3 | nova-compute     | compute     |        30542 |        0 |       0 | NULL            |

| 2014-07-29 19:34:35 | 2014-08-02 17:18:16 | NULL       |  6 | os-node4 | nova-compute     | compute     |        32622 |        0 |       0 | NULL            |

| 2014-07-29 22:33:10 | 2014-08-03 15:27:30 | NULL       |  7 | os-node1 | nova-cells       | cells       |        40640 |        0 |       0 | NULL            |

| 2014-07-29 22:33:13 | 2014-08-03 15:27:32 | NULL       |  8 | os-node1 | nova-console     | console     |        40640 |        0 |       0 | NULL            |

| 2014-08-01 06:22:06 | 2014-08-03 15:27:29 | NULL       |  9 | os-node5 | nova-compute     | compute     |        20510 |        0 |       0 | NULL            |

| 2014-08-01 06:22:11 | 2014-08-03 15:27:30 | NULL       | 10 | os-node6 | nova-compute     | compute     |        20511 |        0 |       0 | NULL            |

+---------------------+---------------------+------------+----+----------+------------------+-------------+--------------+----------+---------+-----------------+

10 rows in set (0.00 sec)

如果确定删除,根据上面的查看信息进行下面的3步操作

mysql> delete from compute_node_stats where compute_node_id=1;

Query OK, 336 rows affected (0.04 sec)

mysql> delete from compute_nodes where service_id=5;

Query OK, 1 row affected (0.02 sec)

mysql> delete from services where id=5;

Query OK, 1 row affected (0.02 sec)

退出数据库后再次查看nova 的service-list,发现os-node3已被删除。

[root@os-node1 ~]# nova service-list

+------------------+----------+----------+---------+-------+----------------------------+-----------------+

| Binary           | Host     | Zone     | Status  | State | Updated_at                 | Disabled Reason |

+------------------+----------+----------+---------+-------+----------------------------+-----------------+

| nova-cert        | os-node1 | internal | enabled | up    | 2014-08-03T15:37:02.000000 | -               |

| nova-consoleauth | os-node1 | internal | enabled | up    | 2014-08-03T15:37:05.000000 | -               |

| nova-conductor   | os-node1 | internal | enabled | up    | 2014-08-03T15:37:02.000000 | -               |

| nova-scheduler   | os-node1 | internal | enabled | up    | 2014-08-03T15:36:57.000000 | -               |

| nova-compute     | os-node4 | nova     | enabled | down  | 2014-08-02T17:18:16.000000 | -               |

| nova-cells       | os-node1 | internal | enabled | up    | 2014-08-03T15:37:00.000000 | -               |

| nova-console     | os-node1 | internal | enabled | up    | 2014-08-03T15:37:02.000000 | -               |

| nova-compute     | os-node5 | nova     | enabled | up    | 2014-08-03T15:36:59.000000 | -               |

| nova-compute     | os-node6 | nova     | enabled | up    | 2014-08-03T15:37:00.000000 | -               |

+------------------+----------+----------+---------+-------+----------------------------+-----------------+