So we have a couple of clusters that contain only 2 hosts for management-related functions, I am trying to automate placing a single host into maintenance mode for our support team to be able to handle hardware related faults and issues both in clusters with greater than 2 hosts and 2 hosts only.
I have made some progress but my challenge has come from one location, disabling HA.
I have the method to do it but the challenge is that you send "Set-Cluster -Cluster $cluster -HAEnabled:$false" and it immediately returns "done" but it isnt, it then spawns a whole bunch of child tasks/processes, Reconfiguring the cluster, removing the Solution, configuring the hosts and then checking compliance which can take an unknown amount of time.
I am really struggling to find a consistent way of identifying those tasks and tracking them and waiting till they are completed and then proceeding to place the host in maintenance mode.
The user/initiator is not consistent (sometimes its the requestor who runs the script, sometimes its VPXD sometimes its "System")
There doesnt appear to be a parent ID that I am seeing linking the tasks together, I cant just grab all tasks based on running status because there are other things going on, Veeam backups and other system tasks so I cant just wait for everything to stop.
I am kinda stumped on this one, I did look at the VCHA module someone wrote but that seems to apply to all clusters in the entire vcenter and I couldnt see a way to just limit it to a single cluster.
Anyone has any suggestions it would be much appreciated.