Today a customer asked me about a specific issue he has in his vSphere environment. They are running a VM that monitors network traffic and they want to make sure the VM is running on esx-1 unless esx-1 goes into maintenance mode.
Easiest way to do this would be to place the VM on host-1 and exclude it from DRS. The problem however is that the VM will not be VMotioned to another host when esx-1 is put into maintenance mode and it will stop the host from entering maintenance mode. Before vCenter 4.1, there would be no other way than to just exclude the VM and VMotion it by hand before entering maintenance mode.
Now in vCenter 4.1, we have DRS Host groups that can help us in this scenario. First create a host group called: HST-Esx-1 and only add the host Esx-1 to this group. Next create a VM group called: VM-NetworkMonitor and only add the VM called NetworkMonitor to this group
Now create a DRS rule of the type “Virtual Machines to Host” and use the two groups you just created and use the policy “Should Run”. For an in-depth explanation of “Should Run” and “Must Run” see Frank Denneman’s blog post: SHOULD OR MUST VM-HOST AFFINITY RULES?
Now with this DRS rule in place, your VM will run on esx-1 and can still be evacuated in case esx-1 has to go into maintenance mode.