有一台ESXi上的虚拟机无法通过vSphere Client重启了,但是通过vSphere Client可以打开主机SSH访问。简单记录一下通过SSH重启vSphere虚拟机的方法。
该方法适用于ESXi 5.x:
1.列出所有虚拟机的inventory ID(Vmid):
~ # vim-cmd vmsvc/getallvms Vmid Name File Guest OS Version Annotation 1 vm1 [vtdatastore01] vm1/vm1.vmx freebsdGuest vmx-08 20 vm2 [vtdatastore01] vm2/vm2.vmx centosGuest vmx-08 28 vm3 [vtdatastore01] vm3/vm3.vmx centos64Guest vmx-08 4 vm4 [vtdatastore01] vm4/vm4.vmx winNetEnterpriseGuest vmx-08 5 vm5 [vtdatastore01] vm5/vm5.vmx windows7Server64Guest vmx-08
2.重启指定Vmid的虚拟机。
~ # vim-cmd vmsvc/power.getstate <vmid> Retrieved runtime info Powered on 3.Reboot the virtual machine with the command: ~ # vim-cmd vmsvc/power.reboot <vmid>
其他参数:
~ # vim-cmd vmsvc/ Commands available under vmsvc/: acquiremksticket get.snapshotinfo acquireticket get.spaceNeededForConsolidation connect get.summary convert.toTemplate get.tasklist convert.toVm getallvms createdummyvm gethostconstraints destroy login device.connection logout device.connusbdev message device.disconnusbdev power.getstate device.diskadd power.hibernate device.diskaddexisting power.off device.diskremove power.on device.getdevices power.reboot device.toolsSyncSet power.reset device.vmiadd power.shutdown device.vmiremove power.suspend devices.createnic power.suspendResume disconnect queryftcompat get.capability reload get.config setscreenres get.config.cpuidmask snapshot.create get.configoption snapshot.dumpoption get.datastores snapshot.get get.disabledmethods snapshot.remove get.environment snapshot.removeall get.filelayout snapshot.revert get.filelayoutex snapshot.setoption get.guest tools.cancelinstall get.guestheartbeatStatus tools.install get.managedentitystatus tools.upgrade get.networks unregister get.runtime upgrade
本文结束。
Leave a comment