doupdates.ps1

doupdates.ps1

This script will automatically update all hosts in a cluster, even without DRS.

It is based on the script in this blog post.  Please do read his post, he covers the necessary prerequisites and talks about some assumptions.  The rest of this document will assume you've read this blog post.

My changes involve around how the guests are moved off to other hosts.  The original script would move guests to a random host, I was not comfortable with that idea.  My changes will inspect all hosts and guests and record the RAM configured to each guests and try to keep memory configured on each host balanced.  It does not take CPU or actual ram usage into account, only guest configured ram in order to minimize the chances of over committing, though if your cluster is not sized to tolerate one host failure without  over committing, them there is a possibility that  over committing will happen.  The script also will put all guests back where they started at the end, just in case you've manually balanced your workloads based on hardware variances.

The process is as follows:

- record which host each guest is on and sum up all configured ram per host

- starting with first host, iterate its guests starting with the one with the most configured ram

-- find the host with the largest difference between host ram and its total guest configured ram

-- recalculate the 2 hosts ram and start a background VMotion to move the guest to the new host

-- repeat until all guests on the host are being moved

-- show progress indicators for the vmotions and wait until all vmotions are complete

-- remediate the host and wait for it to come back up

- repeat the above for each host in the cluster

- when al hosts have been remediated, start tasks to move the guests back to their original hosts.

- show progress indicators for the vmotions and wait until all vmotions are complete

Usage:

The script takes no arguments and needs no configuration, other than the prerrquasited mentioned in the above blog post.  The script will prompt for your vcenter hostname and crdentials, and which clusters and baselines you want to apply.

Attachments
Version history
Revision #:
1 of 1
Last update:
‎08-16-2011 09:46 AM
Updated by: