All,
I'm looking for a way to priortize a startup and shutdown of VM's and ESXi 4.1 hosts in the event of a datacenter outage, leaving the host that is running my vCenter vm powered on. I want to be able to shut the guests down gracefully in an order of my choosing, as well as power them back up (after powering the hosts on manually). I'm looking to use the annotations field in the vm's summary tab as a piece to determine the priority of their shutdown and startup. So, for example, If I priortize my vm's by Group 1; Group 2; Group 3 and have the Script scan the annotations field of the vm's determine which group to shutdown first and which to shutdown last and vise versa for startups.
If you have a simpler idea of how to do this then please advise!
Thanks again for your expertise and assistance!
That should work.
The only flaw I can see is that the custom attributes are only available through the vCenter.
So when the vCenter is down, you have no way of getting the order.
An alternative could be to use the Notes field, that is available when connected to the vCenter or any of the ESXi servers.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The notes field is what I was referring to under the Annotations section on the summary page. Thanks!
I did this a few years ago using the same method. Essentially a note was added to all VM's establishing a ShutdownPriority of 1-9. I also created folders and each VM was put, by the script, into its correct folder based on shutdown priority if it was not already in the correct folder for one reason or another. Then the script shuts down all running VMs in each folder in order with a 60 second pause between folders. Once all VMs are down, then vCenter is shutdown manually.
Hopefully you find this useful in at least getting started in your quest.