I was experimenting with the command line options available via the console on ESXi 4.1 this morning, learning how to start and stop VMs. There's a whole slew of posts which talk about starting a VM (e.g., "vim-cmd vmsvc/power.on 32") but no one talks about stopping them.
Initially, logic led me to believe that "vm-cmd vmsvc/power.off 32" would be the obvious shutdown command. It did turn the VM off. Problem was that it was extremely fast. Too fast. A little research showed that "vm-cmd vmsvc/power.off 32" was the equivalent of holding the power button in on the machine (i.e., no shutdown sequence).
A bit more research shows that I should install vmware-tools and use "vm-cmd vmsvc/power.shutdown 32". It's still quick, but I've logged into the machine to watch what happens and it is going through its shutdown sequence.
So, I now have the background tools to be able to start/stop a number of development systems via a web interface. I only need to do a little coding to get it to work.
Note: "32" in the above examples is the vmid for one of my VMs. Yours will probably vary. You can list yours by running "vm-cmd vmsvc/getallvms".
Update: If you're running 64-bit Ubuntu VMs, you'll likely need to install open-vm-tools and open-vm-dkms before power.shutdown will work. Apparently vmware-tools doesn't work for 64-bit systems. Can anyone very that this is accurate?
No comments:
Post a Comment