VMware ESXiのホストから仮想マシンの電源OFFを行う方法です
※あくまで電源OFFだけで仮想マシンの再起動や電源ONはできません
Powering off a virtual machine on an ESXi host
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1014165
当方はVMWare ESXi 5.0 Build 768111 Free Editionです
- ESXi hostにsshでログイン
- esxcliでプロセス確認
- VMの電源OFF
esxcliコマンドでVMのプロセスを確認します
~ # esxcli vm process list
vMA5
World ID: 3656
Process ID: 0
VMX Cartel ID: 3655
UUID: 56 4d a2 8b 45 ad 48 16-64 a5 f7 69 1d 23 26 c4
Display Name: vMA5
Config File: /vmfs/volumes/4a894076-e3fa7298-ff8b-001b213f600c/vMA5/vMA5.vmx
~ # esxcli vm process kill -t soft -w 3656
-tはshutdown方法の指定で -wはVMのプロセスIDを指定します
通常は”soft”を指定してダメなら”hard”,最後に”force”で強制終了です
参考
1234567891011121314151617181920212223 # esxcli vm process killError: Missing required parameter -w|--world-idMissing required parameter -t|--typeUsage: esxcli vm process kill [cmd options]Description:kill Used to forcibly kill Virtual Machines that are stuckand not responding to normal stop operations.Cmd options:-t|--type=<str> The type of kill operation to attempt. There are threetypes of VM kills that can be attempted: [soft,hard, force]. Users should always attempt 'soft' killsfirst, which will give the VMX process a chance toshutdown cleanly (like kill or kill -SIGTERM). If thatdoes not work move to 'hard' kills which will shutdownthe process immediately (like kill -9 or kill-SIGKILL). 'force' should be used as a last resortattempt to kill the VM. If all three fail then areboot is required. (required)-w|--world-id=<long> The World ID of the Virtual Machine to kill. This canbe obtained from the 'vm process list' command(required)