citrix xen server 虚拟机无法关闭的问题

时间:2023-03-08 20:17:11

悲剧的一台windows的虚拟机无法重启无法关机。如下图,一直卡住不动。

citrix xen server 虚拟机无法关闭的问题citrix xen server 虚拟机无法关闭的问题

首先找到这台机器:

[root@xenserver- xen]# xe vm-list name-label=-vss\ server
uuid ( RO) : 2109ad5d-ba26-d51f-aa61-326f02ded276
name-label ( RW): -vss server
power-state ( RO): running

命令行强制关机无果。

[root@xenserver- xen]# xe vm-shutdown uuid=2109ad5d-ba26-d51f-aa61-326f02ded276 force=true

重置电源状态也行不通。

[root@xenserver- xen]# xe vm-reset-powerstate uuid=2109ad5d-ba26-d51f-aa61-326f02ded276 --force
The operation could not be performed because a domain still exists for the specified VM.
vm: 2109ad5d-ba26-d51f-aa61-326f02ded276 (-vss server)
domid: <unknown>

看来得先取消那个卡死的任务了。首先找到任务。

[root@xenserver- xen]# xe task-list
uuid ( RO) : d0098f61-d056-16ba-571f-917d77cc18c4
name-label ( RO): Connection to VM console
name-description ( RO):
status ( RO): pending
progress ( RO): 0.000 uuid ( RO) : 43fd7023--929a-5e91-6df0afbed23b
name-label ( RO): Async.VM.clean_shutdown
name-description ( RO):
status ( RO): pending
progress ( RO): 0.000 uuid ( RO) : 66a163a2-19e9-9add-fce2-314defe7d667
name-label ( RO): Async.VM.hard_shutdown
name-description ( RO):
status ( RO): pending
progress ( RO): 0.000 uuid ( RO) : fdcf42d3-e042-120e--9fa8de7b4ccf
name-label ( RO): Connection to VM console
name-description ( RO):
status ( RO): pending
progress ( RO): 0.000 uuid ( RO) : 4d3c8f20-4a73-cd6f-07cc-f5a70279fe67
name-label ( RO): Async.VM.hard_shutdown
name-description ( RO):
status ( RO): pending
progress ( RO): 0.000 uuid ( RO) : 2d7c06a9-34e1-dbac-042f-cb33c9ca9a90
name-label ( RO): Async.VM.clean_reboot
name-description ( RO):
status ( RO): pending
progress ( RO): 0.000

接下来取消之。

[root@xenserver- xen]# xe task-cancel uuid=66a163a2-19e9-9add-fce2-314defe7d667
[root@xenserver- xen]# xe task-cancel uuid=4d3c8f20-4a73-cd6f-07cc-f5a70279fe67
[root@xenserver- xen]# xe task-cancel uuid=2d7c06a9-34e1-dbac-042f-cb33c9ca9a90
[root@xenserver- xen]# xe task-cancel uuid=43fd7023--929a-5e91-6df0afbed23b
[root@xenserver- xen]# xe task-list
uuid ( RO) : d0098f61-d056-16ba-571f-917d77cc18c4
name-label ( RO): Connection to VM console
name-description ( RO):
status ( RO): pending
progress ( RO): 0.000 uuid ( RO) : fdcf42d3-e042-120e--9fa8de7b4ccf
name-label ( RO): Connection to VM console
name-description ( RO):
status ( RO): pending
progress ( RO): 0.000 uuid ( RO) : 2d7c06a9-34e1-dbac-042f-cb33c9ca9a90
name-label ( RO): Async.VM.clean_reboot
name-description ( RO):
status ( RO): pending
progress ( RO): 0.000

居然有一个取消不掉的,那得换别的方法。

[root@xenserver- xen]# list_domains
id | uuid | state
| c7910908-e995-4ca4-ab25-d6d630cf0729 | R
| 62799f2c---9b39-fb3949432361 | RH
| fd7c79bb-095b-0e6a-6fd7-96bd156907d8 | B H
| 7a3ebab5-d37a-07cb-df1a-1178391604d4 | B H
| 6449155a-1d8c-1acd-24d5-6fb5d9f8adac | B H
| f2bc15f6-d83c-c888-8cab-a18d98f07a0f | B H
| 2109ad5d-ba26-d51f-aa61-326f02ded276 | B H
| b2d729ec-572b-72af-1e87-646cf78f96d1 | B H
| -bcaa--ce69-8aa4c320ca24 | B H
| 370ec73f---a9df-e5c106840f95 | B
| 198eca87-0b84-a6dd-07b1-08fb4970df59 | B H
| -5f69-48c0-4de4-2a26a3b31a27 | B
[root@xenserver- xen]# /opt/xensource/debug/destroy_domain -domid

至此机器已经处于关闭状态了。

另外非正常关闭的一般会在启动时出现VDI不可用的错误,解决方法如下:

先根据存储的名字找到存储,例如:

xe vdi-list name-label=vip03-sys-226

然后使用下面命令分离:

xe vdi-forget uuid=xxxx存储的uuid

这是虚拟机的存储中就没有这个存储了,再到存储设备里点击重新扫描,等扫描出来后再到vm的存储界面通过连接磁盘添加存储。