Link to home
Start Free TrialLog in
Avatar of JB Blanco
JB BlancoFlag for United States of America

asked on

Need a PowerCLi script to move a host to a new cluster

Vcenter Version 6.7.0.20000 Build 10244845

ESXi version ESXi, 6.5.0, 10719125


Need a powercli script that will

1.)gracefully shutdown all guest vm's running on a single host

2.)Disconnect the host from the cluster its currently on

3.) Reconnect the host to a new cluster

4.) Power on all Guest VM's


THe purpose for this script is to streamline the move of a host to a new cluster with EVC Mode Enabled.
Avatar of Alex
Alex
Flag of United Kingdom of Great Britain and Northern Ireland image

Yeah so, not much point doing this.

Drop the server into maintenance mode, let them trail off naturally.

Disconnect the server from the cluster, reconnect on the other side.

You cannot move both the host + the VM's to a new cluster without V-motioning them off.
Avatar of JB Blanco

ASKER

You sure? what if DRS will be turned off?.  I need the vm's to stay on the host.  Thats why they will be shutdown first.

I need to script this so i can set it to run at a certain time so i don't have to do it manually.  I figured this would be simple enough to understand
You're missing the point here, the VM's are attached to the current cluster, you've actually contradicted yourself in your main question

1.)gracefully shutdown all guest vm's running on a single host

2.)Disconnect the host from the cluster its currently on

Is it a single host or a cluster?
its currently in a cluster as of right now.
if i have to vmotion them off then i guess i have no choice.  Guest VMs will be powered off so there should be no resource contention issues.
Just drop the host into maintenance mode, then V-Motion the other VM's to the new cluster, it's the easiest way.

I mean you could script the v-motion, but you're better off doing them during the day
I'm confused, assuming both clusters can see the storage, there's nothing to stop you adding this host to the new cluster without powering off its guest VMs? Ive done this on many projects in the past, in fact when you add it to the new cluster it asks you to confirm adding all the running VMS to the new cluster? obviously port groups and VLANs also need to match.

This is generally how I replace all the hosts when creating a new cluster on new hardware. (In fact I've got a client that moves servers from Pre Prod to Production using this method (which is convoluted I'll grant you, but that's what they want :) )

If you think about it remove a host from a cluster and add it back to the SAME cluster nothing happens, we used to do this when the HA agent got its knickers in a twist, we didn't down the guests or put the hosts in maint mode. join the host to another cluster is basically the same thing, with the need to sort the licences out afterwards?

P
I'm confused, assuming both clusters can see the storage, there's nothing to stop you adding this host to the new cluster without powering off its guest VMs? Ive done this on many projects in the past, in fact when you add it to the new cluster it asks you to confirm adding all the running VMS to the new cluster? obviously port groups and VLANs also need to match.

This is generally how I replace all the hosts when creating a new cluster on new hardware. (In fact I've got a client that moves servers from Pre Prod to Production using this method (which is convoluted I'll grant you, but that's what they want :) )

If you think about it remove a host from a cluster and add it back to the SAME cluster nothing happens, we used to do this when the HA agent got its knickers in a twist, we didn't down the guests or put the hosts in maint mode. join the host to another cluster is basically the same thing, with the need to sort the licences out afterwards?

The purpose for this is i need to move these hosts to an EVC Enabled Cluster.  The VM's are currently using the instruction sets of a CPU family that is higher than what the EVC Enabled Cluster is set to.  Therefore, vm's will have to be powered off.  Are you implying that i can move the host from its current cluster to the EVC Enabled one without powering off the VM's?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.