One of the new features in vSphere 4.1 is the ability to configure Host affinity rules for DRS. These enable you to split your vSphere cluster in several groups of hosts and assign assign a subset of your VMs to one of these groups.
There are plenty of use cases for this:
– Netapp Metrocluster
– Applications licensed based on CPUs
– performance sensitive applications
In my case the cluster is spread over 2 sites, one production site and a failover site. The failover site is used to run test & dev servers. Only in case of serious problems on the production site the VMs should be moved to the failover site.
Open the cluster settings and create a “Virtual Machines DRS Group”
I create a group called FailoverSiteVMs which contains the test & dev servers.
A second group is called ProductionSiteVMs which contains the production virtual machines.
Now we need to create 2 “Hosts DRS Groups. One for the FailoverSite.
And another one for the Production site.
An overview of the configured groups
Once all the groups are created you can start creating DRS rules. Select the “Virtual Machines to Hosts” as type, the Cluster Vms Group and the Cluster Hosts Groups.
There are 2 main types of DRS rules:
- Should run on hosts in group
- Must run on hosts in group
- The “Should run on hosts in group” rule keeps the VMs on the configured hosts but HA can violate the DRS rules and start the VMs on the failover hosts.
When the “Must run on hosts in group” type is used HA won’t violate the DRS rules and the VMs won’t be restarted on the failover hosts.
Once the rules are configured the rules dialog looks like this.