An embodiment of a system for managing energy identifies a plurality of groups of virtual machines in a computer system and allocates the energy in the computer system for a next time interval to a plurality of groups of virtual machines based on an energy budget and a policy selected from a set of policies in conjunction with a minimum energy, a group priority and a virtual machine priority.