Server virtualization has made it so easy to create new VMs that many organizations find themselves struggling to keep pace with the resulting VM sprawl. The problem with manual virtual server management is there eventually comes a point when the sheer number of virtual servers renders manual management techniques impractical. Fortunately, there are a number of ways in which a virtual server environment can take advantage of automation.
One of the first things that you should focus on automating is virtual machine (VM) placement. Your hypervisor needs to be smart enough to run a virtual server on the most appropriate host.
System Center 2012 R2 Virtual Machine Manager attempts to influence host placement from the very beginning. When an administrator creates a new VM, the Create VM Wizard asks which host the VM should reside on. The wizard provides a star rating for each host based on its suitability for running the new VM, as shown in Figure A.
The star ratings are based on the VM's hardware requirements. As you can see in the example above, there is an Expected Utilization button that you can click in order to give Virtual Machine Manager a better idea of the load that you expect the new VM to produce. This allows Virtual Machine Manager to provide a better estimate of which host is the most capable of running the VM.
Although the initial VM placement is important, virtual servers are anything but static. A VM's resource consumption can change over time in response to evolving demands. Furthermore, there is a good chance VMs will be live migrated several times throughout their lives. It is these factors that drive the need for automation.
Initially choosing the best host on which to create a VM is important, but it is even more important to make sure the VM continues to be run on the best possible host as demands change over time. This is where dynamic optimization comes into play.
Dynamic optimization is a Virtual Machine Manager feature that causes VMs to be automatically live migrated in response to changes in the available host resources. Dynamic optimization is a host cluster function, but is configured at the host group level rather than through the Failover Clustering Manager.
The dynamic optimization feature, shown in Figure B, works by taking stock of system resources on a scheduled basis (every 10 minutes by default). The feature compares the available resources (such as CPU, disk I/O and memory) on each host to a set of predetermined threshold values. If the VMs running on a host server have consumed a sufficient amount of resources to exceed the threshold values you have established, then one or more VMs will be live migrated to an alternate host. You can think of this capability as load balancing for VMs within a failover cluster.
The dynamic optimization feature works to help spread VMs across all the hosts in a cluster. However, the power optimization feature does the opposite. During periods of low activity (such as late at night), the power optimization feature can consolidate the virtual servers onto fewer hosts so some host servers can be shut down to save power.
There are a few important things that must be understood about this feature. First, it can only be used if the dynamic optimization feature has been enabled. Second, because dynamic optimization occurs at the cluster level, the cluster must have a sufficient number of nodes to allow nodes to be shut down without the cluster losing quorum. Finally, using power optimization requires the physical hardware to have a baseboard management controller that allows for out-of-band management. You can read more about dynamic optimization and power optimization from Microsoft's online TechNet resources.
When it comes to creating VMs, host placement isn't the only consideration. It is also important to make sure VMs are created in a consistent manner that fully complies with your organization's security policies. This is especially true if users will be using a self-service interface to create their own VMs. In these types of situations, it is possible to automate the VM creation process through the use of VM templates.
One more process you should consider automating is VM backups. Although not technically "VM automation," your backup needs to have sufficient intelligence to respond to events such as VM creation and migration. Newly created VMs should be backed up automatically without an administrator having to explicitly add the new VM to a backup job. Existing VMs should continue to be backed up, even if they have been migrated to an alternate host.
As you can see, there are a number of ways in which your infrastructure can benefit from automation. Although Hyper-V was used for the examples in this article, VMware offers similar automation methods.