Hi,
Just a beginner regarding PowerCli and not sure how to solve the following
We have multiple clusters because of licensing: Oracle, MS SQL and one cluster with application VMs.
Therefore I see no other option than using the HA restart delays to do some orchestration after an HA failure.
Each cluster has production, test, development and acceptance VMs. For production VMs I change the HA restart delay. This way VMs in de database clusters are started before the application VMs.
For all other VMs I want a specific restart delay depending on a custom attribute which tells if the VM is acceptance, test or development. This can be done manually using the VM overrides option in the cluster configuration but how to do this using Powershell so that we can automate this I have really no idea. Google search did not help me this time.
Hopefully someone can show me where to look.
Best regards,
Patrick
You can use the HARestartPriority parameter on the Set-VM cmdlet.
This gives you access to all the priorities (lowest,low,medium,high,highest and disabled).
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can use the HARestartPriority parameter on the Set-VM cmdlet.
This gives you access to all the priorities (lowest,low,medium,high,highest and disabled).
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you very much for you very swift reply.
Was thinking about using restart delays only but combining default restart delays with restart priorities should work.
So:
- Oracle + SQL cluster : default restart delay 30 secs
* PRD : priority high
* ACC : priority medium
* DEV : priority low
* TST : priority low
- Application VMs : default restart delay 90 secs
* AD/DNS : restart delay 0 secs
* PRD : priority high
* ACC : priority medium
* DEV : priority low
* TST : priority low
Plenty of Set-VM example scripts so I should be able to figure that out.
Sounds like a plan. Thanks again
Feel free to ask if you get stuck somewhere
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Almost there:
This works : Get-VM SRV00220 | Set-VM -HARestartPriority High -Confirm:$false
This works : Get-Datacenter NL001 | Get-Cluster Production | Get-VM | Get-Annotation -CustomAttribute "Application Environment" | where {$_.Value -eq "Acceptance"}
But when I pipe the result of the 2nd to the 1st:
Get-Datacenter NL001 | Get-Cluster Production | Get-VM | Get-Annotation -CustomAttribute "Application Environment" | where {$_.Value -eq "Acceptance"} | Set-VM -HARestartPriority High -Confirm:$false
then I get the error
I suppose this is caused because output of the 2nd command is not the VM itself. But no idea how to fix it
Some help would be very welcome
Try like this
Get-Datacenter NL001 | Get-Cluster Production |
Get-VM |
where{Get-Annotation -Entity $_ -CustomAttribute "Application Environment" | where {$_.Value -eq "Acceptance"}} |
Set-VM -HARestartPriority High -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Works like a charm
I even think I understand the fix
Dank u wel