VMware DRS rule manipulation using PowerCLI (EMC VPLEX use case) Part 1.

By | November 28, 2016

VPLEX is another of my favourite products,  and for good reason. I currently run a Metro cluster underneath a VMware platform that has proven to be super reliable.

One important design consideration for this is to ensure that VM’s are configured for site bias.

Why ? Glad you asked. In a VPLEX Metro configuration, a VPLEX detach rule is defined for every Distributed Virtual volume. If a communication failure occurs between the two VPLEX clusters, these detach rules define which cluster should detach it’s mirror leg to prevent both sites continuing to permit I/O activity during a failure. If this was not done, data inconsistency is the obvious outcome.

The site with bias ( the preferred site) will continue to service the I/O to the volume(s) and the non-preferred site will suspend all I/O. This process is transparent to the users and is fully automated.


Once the communications issue is resolved (in our case, monitored by the VPLEX witness) the Distributed volumes will be re-synched and I/O will resume.

TL:DR ??

Here’s a quick and easy PowerCLI script that enumerates all the Virtual Machines that are running off a set of datastores with the same prefix, and then add’s them to a DRS Group that has a ‘should‘ rule;

The Datastores all have the same prefix in their name “SiteA_VPLEX” and the DRS Group Rules are called “SiteA_VMs SiteBVMS”  ( 1 rule, VM Group and Datastore list per side of the cluster)

This makes use of the most-excellent DRSRule module by Luc Dekens & Matt Boren available from github.

In my next post I’ll expand this theme to report on the missing VM’s from the groups and email this to a recipient for review of the action.


2 thoughts on “VMware DRS rule manipulation using PowerCLI (EMC VPLEX use case) Part 1.

  1. Thefluffyadmin

    Great post. We use similar script. 1 SDRS cluster for each detach group. Script adjusts DRS based on VM vnx file location


Leave a Reply

Your email address will not be published. Required fields are marked *