VCP-6 Objective 9.2–Configure Advanced vSphere DRS Features

For this object I used the following resources

  • vSphere Resource Management guide

Objective 9.2 – Configure Advanced vSphere DRS Features

Knowledge

Identify Distributed Resource Scheduler (DRS) Affinity Rules

With Distributed Resource Scheduler (DRS going forward) enabled on your vSphere cluster you can manage the placement of virtual machines within that cluster. The use of an affinity rule allows for this level of control. There are two types of of rules:

  • VM-Host Affinity – Used to specify affinity or anti-affinity between a group of virtual machines and a group of hosts. An affinity rule specifies that the members of a selected virtual machine DRS group can or must run on the members of a specific host DRS group. An anti-affinity rule specifies that the members of a selected virtual machine DRS group cannot run on the members of a specific host DRS group.
  • VM-VM Affinity – Used to specify affinity or anti-affinity between individual virtual machines. A rule specifying affinity causes DRS to try to keep the specified virtual machines together on the same host, for example, for performance reasons. With an anti-affinity rule, DRS tries to keep the specified virtual machines apart, for example, so that when a problem occurs with one host, you do not lose both virtual machines

Enable/Disable Distributed Resource Scheduler (DRS) Affinity Rules

As mentioned above there are two types of affinity rules, VM to Host and VM to VM affinity. The process for creating each type of rule (and their prerequisites) are outlined below.

Create a Host DRS Group – A VM-Host affinity rule establishes an affinity (or anti-affinity) relationship between a virtual machine DRS group with a host DRS group. You must create both of these groups before you can create a rule that links them.

  • Log into the vSphere Web Client with administrative privileges
  • From the Home screen in the vSphere Web Client, select Hosts and Clusters in the right hand navigation
  • In the left hand pane select expand your Datacenter object and select the vSphere Cluster
  • Right click on the vSphere Cluster and select Settings
  • In the right hand pane under Configuration select VM/Host Groups
  • Click the Add button on the right
  • Provide a Name for the group and for the Type dropdown select Host Group
  • Click Add and select the needed ESXi hosts, click OK
  • Click OK  to finish.

Screen shot below shows my ESXi Host Group in my lab:

ESXi-HostGroup

Create a Virtual Machine DRS Group

  • Log into the vSphere Web Client with administrative privileges
  • From the Home screen in the vSphere Web Client, select Hosts and Clusters in the right hand navigation
  • In the left hand pane select expand your Datacenter object and select the vSphere Cluster
  • Right click on the vSphere Cluster and select Settings
  • In the right hand pane under Configuration select VM/Host Groups
  • Click the Add button on the right
  • Provide a Name for the group and for the Type dropdown select VM Group
  • Click Add and select the needed ESXi hosts, click OK
  • Click OK  to finish.

Screen shot below shows my VM Group in my lab:

VM-HostGroup

    Now with hour host and virtual machine groups defined we can create some actual affinity rules. For our first example we will create a VM to Host rule:
  • Log into the vSphere Web Client with administrative privileges
  • From the Home screen in the vSphere Web Client, select Hosts and Clusters in the right hand navigation
  • In the left hand pane select expand your Datacenter object and select the vSphere Cluster
  • Right click on the vSphere Cluster and select Settings
  • In the right hand pane under Configuration select VM/Host Rules
  • Click the Add button on the right
  • Provide a Name for the rule and check the Enable Rule check box
  • From the Type dropdown select Virtual Machines to Hosts
  • From the VM Group and Host Group select you created groups accordingly
  • Select a specification for the rule
    • Must run on hosts in group – Virtual machines in VM Group must run on hosts in Host Group
    • Should run on hosts in group – Virtual machines in VM Group should, but are not required, to run on hosts in Host Group
    • Must not run on hosts in group – Virtual machines in VM Group must never run on hosts in Host Group
    • Should not run on hosts in group – Virtual machines in VM Group should not, but might, run on hosts in Host Group
  • Click OK

Screen shot below over competed VM to Host Affinity rule:

VM2Host

Creating a VM to VM Affinity Rule

  • Log into the vSphere Web Client with administrative privileges
  • From the Home screen in the vSphere Web Client, select Hosts and Clusters in the right hand navigation
  • In the left hand pane select expand your Datacenter object and select the vSphere Cluster
  • Right click on the vSphere Cluster and select Settings
  • In the right hand pane under Configuration select VM/Host Rules
  • Click the Add button on the right
  • Provide a Name for the rule and check the Enable Rule check box
  • In the Type dropdown select the type of rule
    • Separate Virtual Machines
    • Keep Virtual Machines Together
  • Click the Add and selected the desired virtual machines

Screen shot below over competed VM to VM Affinity (separate virtual machines) rule:

VM2VM

Identify Distributed Resource Scheduler (DRS) Automation Levels

Configure Distributed Resource Scheduler (DRS) Automation Levels

Going to bundle these two topics together as they are some closely aligned. VMware vSphere DRS supports three levels of “automation” for virtual machine initial placement and migration. I put automation in quotes, as you will see in the table below the first option, manual, isn’t so automated.

Automation Level Action

Manual

  • Initial placement: Recommended host is displayed
  • Migration: Recommendation is displayed

Partially Automated

  • Initial placement: Automatic
  • Migration: Recommendation is displayed

Fully Automated

  • Initial placement: Automatic
  • Migration: Recommendation is executed automatically

Configuring DRS can take place during the vSphere Cluster object creation, or if not enabled during creation can be enabled after the fact. To enable DRS post cluster creation complete the following steps:

  • Log into the vSphere Web Client with administrative privileges
  • From the Home screen in the vSphere Web Client, select Hosts and Clusters in the right hand navigation
  • In the left hand pane select expand your Datacenter object and select the vSphere Cluster
  • Right click on the vSphere Cluster and select Settings
  • In the right hand pane under Services select vSphere DRS
  • Click the Edit button on the right
  • Select the check box for Turn on vSphere DRS
  • In the DRS Automation dropdown select the the automation level
  • Click OK

Screen shot below DRS being enabled/turned on my lab cluster:

DRS_Enabled

That wraps up Objective 9.2, happy studying!

-Jason