«

nova重置虚拟机状态

指尖二进制 • 1 年前 • 1139 次点击 • OPENSTACK


遇到一个报错虚拟机的状态一直是错误或者创建中,硬重启都解决不了。

[root@node-1 ~]# nova reboot --hard 011dc8e8-969c-4e32-aaf0-173d645078b7
Request to reboot server <Server: soho-erp2nc> has been accepted.
[root@node-1 ~]# nova list --all --host=node-3
+--------------------------------------+---------------+----------------------------------+---------+------------+-------------+-------------------------------+
| ID                                   | Name          | Tenant ID                        | Status  | Task State | Power State | Networks                      |
+--------------------------------------+---------------+----------------------------------+---------+------------+-------------+-------------------------------+
| 011dc8e8-969c-4e32-aaf0-173d645078b7 | soho-erp2nc   | 4811ffe162594e63868e913139c40648 | ACTIVE  | -          | Running     | Switch_vid3111=192.168.11.153 |
| 5300e364-a2de-4d51-a847-e21fa0d3492d | soho-hqERPnew | 4811ffe162594e63868e913139c40648 | REBUILD | rebuilding | NOSTATE     | Switch_vid3111=192.168.11.159 |
+--------------------------------------+---------------+----------------------------------+---------+------------+-------------+-------------------------------+
[root@node-1 ~]#
[root@node-1 ~]#
[root@node-1 ~]# nova list --all --host=node-3
+--------------------------------------+---------------+----------------------------------+---------+------------+-------------+-------------------------------+
| ID                                   | Name          | Tenant ID                        | Status  | Task State | Power State | Networks                      |
+--------------------------------------+---------------+----------------------------------+---------+------------+-------------+-------------------------------+
| 011dc8e8-969c-4e32-aaf0-173d645078b7 | soho-erp2nc   | 4811ffe162594e63868e913139c40648 | ACTIVE  | -          | Running     | Switch_vid3111=192.168.11.153 |
| 5300e364-a2de-4d51-a847-e21fa0d3492d | soho-hqERPnew | 4811ffe162594e63868e913139c40648 | REBUILD | rebuilding | NOSTATE     | Switch_vid3111=192.168.11.159 |
+--------------------------------------+---------------+----------------------------------+---------+------------+-------------+-------------------------------+
[root@node-1 ~]# nova reboot --hard 5300e364-a2de-4d51-a847-e21fa0d3492d
Cannot 'reboot' instance 5300e364-a2de-4d51-a847-e21fa0d3492d while it is in task_state rebuilding (HTTP 409) (Request-ID: req-067291db-149d-4e7e-a7e3-d9fdc057eb67)
ERROR (CommandError): Unable to reboot the specified server(s).
[root@node-1 ~]#

这时候只有通过 nova reset-state 先恢复状态了,该指令会把 instance 的 Task State 恢复为 None,然后就正常了。

[root@node-1 ~]# nova --help|grep reset
    reset-network               Reset network of a server.
    reset-state                 Reset the state of a server.

状态已经修复,可以 stop && start 了

[root@node-1 ~]# nova reset-state 5300e364-a2de-4d51-a847-e21fa0d3492d
Reset state for server 5300e364-a2de-4d51-a847-e21fa0d3492d succeeded; new state is error
[root@node-1 ~]#
[root@node-1 ~]# nova reboot --hard 5300e364-a2de-4d51-a847-e21fa0d3492d

Request to reboot server <Server: soho-hqERPnew> has been accepted.
[root@node-1 ~]#
[root@node-1 ~]# nova list --all --host=node-3
+--------------------------------------+---------------+----------------------------------+--------+------------+-------------+-------------------------------+
| ID                                   | Name          | Tenant ID                        | Status | Task State | Power State | Networks                      |
+--------------------------------------+---------------+----------------------------------+--------+------------+-------------+-------------------------------+
| 011dc8e8-969c-4e32-aaf0-173d645078b7 | soho-erp2nc   | 4811ffe162594e63868e913139c40648 | ACTIVE | -          | Running     | Switch_vid3111=192.168.11.153 |
| 5300e364-a2de-4d51-a847-e21fa0d3492d | soho-hqERPnew | 4811ffe162594e63868e913139c40648 | ACTIVE | -          | Running     | Switch_vid3111=192.168.11.159 |
+--------------------------------------+---------------+----------------------------------+--------+------------+-------------+-------------------------------+
[root@node-1 ~]#
还没收到回复