In my last project, I was working with Nutanix metro cluster running on VMware ESXi. Unfortunately, Nutanix and VMware vSphere don’t provide any way to automatically distribute virtual machines based on datastore to site location.

One could ask why do you need to distribute or pin virtual machines to the specific datastore? The answer is quite straightforward. Let’s take under the consideration following scenario.

Suboptimal placement

Virtual machine components (CPU, RAM) are located on site B where reads/writes are on site A (traversing via network). In this situation virtual machine performance is suboptimal.

Optimal placement

Virtual machine components (CPU, RAM, disk) are located on site A where reads/writes are local (not traversing via network). In this situation virtual machine performance is optimal.

PowerCLI script to create Metro Cluster aware DRS groups

For the project needs, I created an extremely simple PowerCLI script(it is not even script, possibly some PowerCLI gurus would create a one-liner from it 😉 ). Anyway, it did work for me. As a final solution script was executed twice a day to balance the virtual machines across two sites.

The script is pretty much straightforward. Simply at the beginning provide the values to connect to vCenter Server and others to make the script work.

PowerCLI script to create Metro Cluster aware DRS groups
5 (100%) 2 votes
Wojciech Marusiak
Social Media

Wojciech Marusiak

Solution Architect at Alibaba Cloud
I am innovative and experienced IT professional with over 12 years in the IT industry.

My experience and skills have been proven by leading vendor certifications like AWS, Alibaba Cloud, VMware, and Microsoft. I contribute to IT community and I received VMware vExpert 2014 - 2017 and VMware vExpert NSX 2017 Award.

My blog wojcieh.net - was voted #43 in Top vBlog 2017 contest!

Do what you love, and you’ll never work another day in your life.
Wojciech Marusiak
Social Media