計算節點宕機後,vm的遷移方法
當計算節點異常斷電或者發生故障後,導致計算節點無法正常工作,這時該計算節點上面的vm如何遷移到別的可用計算節點上呢?
由於宕機的計算節點上面的nova-compute服務已經down了,所以shelve和migrate操作無法執行,會報錯。
nova中提供了Evacuate命令,該命令可以將vm從宕機或者故障的計算節點上面遷移到可用的計算節點上,並在新的計算節點上rebuild該vm。
該命令只能在命令列操作,並且前提是宕機的節點和可用的節點間有共享儲存。
[[email protected] ~]# nova help evacuate
usage: nova evacuate [--password <password>] [--force] <server> [<host>]
Evacuate server from failed host.
Positional arguments:
<server> Name or ID of server.
<host> Name or ID of the target host. If no host is
specified, the scheduler will choose one.
Optional arguments:
--password <password> Set the provided admin password on the evacuated
server. Not applicable if the server is on shared
storage.
--force Force to not verify the scheduler if a host is
provided. (Supported by API versions '2.29' -
'2.latest')
[[email protected]
+----------------------+----------------------+---------+----------------------+------------------------+
| ID | Name | Status | Networks | Image Name |
+----------------------+----------------------+---------+----------------------+------------------------+
| 07ff8391-47d4-4304-8 | demo | SHUTOFF | private63=10.0.0.6 | |
| b76-6db5bd65a8c0 | | | |
[[email protected] ~]# nova evacuate demo
到介面上面可以看到該vm已經遷移到可用的計算節點上,並正常運轉了。