Contributor
Contributor

Script to migrate all VMs to a new cluster and put hosts into maintenance mode

Hello All,

I have the follow scenario that I'm not able to solve:

1) cluster 1 with 2 hosts

2) cluster 2 with 2 hosts

3) VCSA is on separate host

3) the hosts are in the same network 10.1.30.x

4) I've created a DSwitch too to merge all the hosts

The manual vMotion works like a charm I can move the VM from one host of cluster 2 to an host to cluster 1 or directly cluster to cluster.

What I want to do is to force both the cluster 2 hosts in maintenance mode and expect that the active VM will vMotion to the cluster 1.

Annotazione 2020-04-20 150031.jpg

Any suggestion will be appreciated.

Many thanks

Massimo

Tags (1)
0 Kudos
5 Replies
Leadership
Leadership

That would be DRS across clusters, however DRS is a function to manage the compute resources of a single cluster and does not operate across multiple clusters.

Put either of the 2 hosts in the same DRS cluster into maintenance mode and the VMs should migrate (if your DRS is fully automated) to the other host in the same cluster, but this won't work across clusters.

Perhaps a PowerCLI script would be your best approach - identify all the VMs in your cluster, have them all migrate, then put the hosts into maintenance mode.

This would be the right place to post about such a script: VMware PowerCLI  - I can move this thread there if you wish?

0 Kudos
Contributor
Contributor

Hello Scott thank you so much for the answer. Yes please move move this thread there.

Massimo

0 Kudos
Leadership
Leadership

Moderator note: Moved to the PowerCLI area.

As there is no built-in function for DRS to migrate across clusters, the user wishes to achieve the equivalent with a script:

1. Identify all VMs in a cluster

2. Migrate all those VMs to hosts in a different cluster

3. Place the hosts in the first cluster into maintenance mode

The above would also need to be reversed following the maintenance window, returning all migrated VMs back into the first cluster.

0 Kudos
Contributor
Contributor

Thank you so much Scott, we will implement the script on our Network adapter using the Vmware API.

Massimo

0 Kudos
Leadership
Leadership

0 Kudos