Using the DRS affinity and anti-affinity rules
In this section, we will discuss the advanced settings of a cluster. We can use the following cmdlets for this section:
Get-DrsRule
New-DrsRule
Remove-DrsRule
Set-DrsRule
First, we will create a new anti-affinity rule with the two Test1
and Test2
VMs that we created for this purpose. We want to always keep them separate in such a way that they will not run on a single host at any point of time. For this, we will use the New-DrsRule
cmdlet to create a rule. We will use the following command for this:
PS C:\> New-DrsRule –Cluster 'Lab Cluster' –Name ` antiAffinityTest1 -KeepTogether $false –VM Test1, Test2
The result of the preceding command is shown in the following screenshot:
Note the warning about the Cluster
parameter. This warning is displayed to show you that this parameter is obsolete and should be avoided. We can check the details of the rule using the Get-DrsRule
cmdlet.
We can change a rule using the Set-DrsRule
cmdlet. In the...