Hello all,
I'm tasked with creating a script to invoke the suspension of over 50 VM's (all Win2012r2) in a very narrow timeframe (probably between 5-8 minutes) following a UPS event.hutfown
Suspend over shutdown is the preferred option, but as there's no -RunAsync switch for this, I'd be grateful for any advice anyone could offer as to how to achieve this.pped
I have this snippet for the SQL boxes working fine, but the servers suspend in sequence, rather than simultaneously.
$vms = Get-VM
Foreach ($vm in $vms){
if ((Get-View $vm).Name -match "SQL"){
Write-Host $vm.Name, " => " , (Get-View $vm).Guest.GuestFullName
Get-VM $vm | Suspend-VMGuest -Confirm: $false
}
}
Many thanks,
Tim
Just to kind of level set with you, although it may be possible to do so (Luc will chime in, no doubt), do you realize this type of action will probably pummel your storage to no end while it writes out the memory contents to disk? Depending on your storage performance, connectivity technology, and amount of data to write, this may not be something you can complete on over 50 VMs in that time period. I bring that up because I attempted to do the same thing once and it just wasn't possible and created more problems than it attempted to solve. Graceful shutdown ended up being the safest and quickest method in a power outage situation. Food for thought...
Hi - thanks for such a quick reply.
It's a VSAN environment, so at least the storage is contained. Your point is well-made, however.
It might be that I reserve the suspend for the database servers, as they're likely to take the longest time to drop, and reserve the Shutdown-VMGuest for the rest, as the application owners have stated their systems can cope with a OS-invoked shutdown.
My other thought was to batch the suspends, say 8 at a time, but even pulling that from a list will execute them sequentially, as far as I can tell.
Tim
Your experience may turn out to be different (based on how you have your applications designed and interconnected), but suspending and resuming DB servers almost never ends well. Since those are the most memory-intensive workloads but also have the highest number of connections to monitor, resuming them from a suspended state inevitably yields a non-functional application (connection drops that won't reestablish, stale pages, etc.). Unless your vSAN is all flash and highly capable, you may still need to guest shutdown those high memory VMs. Again, YMMV, so try it out in your environment and see what works for you.
Thanks again.
The project is still in it's early-ish stages, so options are open. I'm very dubious about suspend/resume on db servers too, so I'm very glad to have that confirmed.
Tim