VMware Cloud Community
Prost
Contributor
Contributor
Jump to solution

Script DRS Automation Level

I am using DRS in vCenter and it works great.  I have the level set at fully automated and applied the priority to 3.   I don’t use Update Manager for patching because the business wants a single location to observer success and failures. 

My problem is when Windows patching my guests reboots and DRS starts migrating because of the added load from Windows booting which increases the time it takes to complete patching.

Is there a command to set DRS to manual or lower the priority so it doesn’t migrate guests when they are rebooting durring Windows patching?

0 Kudos
1 Solution

Accepted Solutions
Chamon
Commander
Commander
Jump to solution

With powerCLI to set the cluster to manual:

get-cluster -cluster $mycluster -drsautomationlevel manual -confirm:$false

And back to fully automated:

get-cluster -cluster $mycluster -drsautomationlevel fullyautomated -confirm:$false

View solution in original post

0 Kudos
5 Replies
vmroyale
Immortal
Immortal
Jump to solution

Hello.

Note: This discussion was moved from the VMware vCenter Server community to the Automation Tools community.

Good Luck!

Brian Atkinson | vExpert | VMTN Moderator | Author of "VCP5-DCV VMware Certified Professional-Data Center Virtualization on vSphere 5.5 Study Guide: VCP-550" | @vmroyale | http://vmroyale.com
0 Kudos
Chamon
Commander
Commander
Jump to solution

I think LucD helped me with this in the past. Here is a portion from our script that you would need (in red) to configure the entire cluster with our settings. The rate is 1 for most aggressive and 5 for least aggressive. You can also temporaraly set the cluster to manual if you wanted. 

##Connect to the vCenter Server
Connect-viserver $vc -Credential $vcCred

foreach ($item in get-content c:\sites\sites.txt) {

$sitename=$item

$cluster="$sitename Cluster"

#Create a folder for the new site
New-Folder -Name $Sitename  -Location $datacenter   -Confirm:$false

#Create a cluster for the new site

New-Cluster -Name $cluster -Location $sitename -HAEnabled:$true -DrsEnabled:$true -DrsAutomationLevel fullyautomated -confirm:$false

#Set HA Advanced Configuration option to extend Failure detection time to 60 seconds

$optionValue = New-Object Vmware.Vim.OptionValue
$optionValue.Key = "das.failuredetectiontime"
$optionValue.Value = "60000"


$getcluster = get-cluster -Name $cluster     # Get the cluster
$clusterview = get-view $getcluster.Id      # Get the SDK object from the PowerCli object MO

$spec = New-Object Vmware.Vim.ClusterConfigSpecEx
$spec.dasConfig = New-Object Vmware.Vim.ClusterDasConfigInfo   # New VMware HA config

$spec.dasConfig.option = $optionValue      # Add the array of optionValues
$clusterview.ReconfigureComputeResource($spec, $true)    # Modify the configuration. When configuring clusters, can be a ClusterConfigSpecEx object

# Get the SDK object from the PowerCli object MO and set DRS threshold

$rate = 2

$clusSpec = New-Object VMware.Vim.ClusterConfigSpecEx
$clusSpec.drsConfig = New-Object VMware.Vim.ClusterDrsConfigInfo
$clusSPec.drsConfig.vmotionRate = $rate
$clusterview.ReconfigureComputeResource_Task($clusSpec, $true)

}

0 Kudos
Chamon
Commander
Commander
Jump to solution

With powerCLI to set the cluster to manual:

get-cluster -cluster $mycluster -drsautomationlevel manual -confirm:$false

And back to fully automated:

get-cluster -cluster $mycluster -drsautomationlevel fullyautomated -confirm:$false

0 Kudos
bulletprooffool
Champion
Champion
Jump to solution

The trickery is the correlation between DRS clusters and Windows clients.

If you are patching VMs based on their VMware clusters, it should simply be a matter disabling' DRS on the cluster during patching. If you are looking to actually disable it on a VM by VM basis, then your CMDLET is Set-VM. Of course all the load on VMs during reboots means that if you are patching large numbers of VMs on a host, DRS will kick in to spread the load (under normal circumstances)

http://www.vmware.com/support/developer/PowerCLI/PowerCLI41U1/html/Set-VM.html

You'll just want to change the VM's automation level before and after the patch job.

One day I will virtualise myself . . .
0 Kudos
Prost
Contributor
Contributor
Jump to solution

This is perfect thanks,

One more question does anybody else have this problum?  How did you resolve the issue?

Thanks again the cmd works great.

0 Kudos