平台中有一些计算节点下架,通过nova service-delete ID将其删除后,admin用户登录dashboard,提示"Can\'t get hareware usage",之后迅速退出登录,后台执行nova hypervisor-list命令后,无法执行成功,提示如下报错:
ERROR (ClientException): Unexpected API Error. Please report this athttp://bugs.launchpad.net/nova/ and attach the
Nova API log if possible.
<class \'nova.exception.ComputeHostNotFound\'> (HTTP 500) (Request-ID: req-3b2c76d8-3cfd-405f-bf9d-418524e92131)
原因: 删除计算节点的过程中,nova service-list所呈现的信息与nova hypervisor-list所呈现的数据不一致,nova-all.log中提示如下信息:
解决方法: 基于nova service-list的信息确保compute_nodes表格一致,
[root@node-6 ~]# mysql
mysql> use nova;
mysql> show tables;
mysql> desc compute_nodes;
mysql> select host_ip,hypervisor_hostname from compute_nodes;
+---------------+--------------------------------------------------+
| host_ip | hypervisor_hostname |
+---------------+--------------------------------------------------+
| 192.168.4.3 | node-1.domain.tld |
| 192.168.4.6 | node-4.domain.tld |
| 192.168.4.7 | node-5.domain.tld |
| 192.168.2.205 | domain-c794.907DA621-15BD-4094-B4A9-5D2FD673591D |
| 192.168.2.207 | 87cc96aa-198a-4b2b-b713-10579cbed210 |
| 192.168.2.207 | 0834bd41-6165-4b94-a333-8f69c6f22a48 |
| 192.168.2.207 | 0834bd41-6165-4b94-a333-8f69c6f22a48 |
| 192.168.2.207 | 87cc96aa-198a-4b2b-b713-10579cbed210 |
| 192.168.2.207 | 5645e6ab-3b93-4a48-b677-807083f59970 |
| 192.168.2.207 | 1aa3d25d-d0d0-44c2-94c1-4c24ec20d051 |
| 192.168.2.205 | domain-c794.907DA621-15BD-4094-B4A9-5D2FD673591D |
| 192.168.2.205 | 3ad8e7c1-1ece-405d-a14d-7ef4447a2ce9 |
| 192.168.2.206 | domain-c794.907DA621-15BD-4094-B4A9-5D2FD673591D
可以看到有大量数据残留。
删除无效数据即可
mysql> delete from compute_nodes where hypervisor_hostname=\'domain-c794.907DA621-15BD-4094-B4A9-5D2FD673591D\';
Query OK, 21 rows affected (0.00 sec)
如下是已经删除的后的结果:
compute_nodes表格中数据内容