DRS VM affinity/anti-affinity rules - these are lost when DRS is disabled - they can be "listed" via perl script or VI Toolkit for manual re-entering if needed ...
But can they be backed up / restored via automated methods for easy restoration in case of required or accidental disabling of DRS? What if a vCenter user disables instead of setting to manual during operations?
I have over 100+ DRS VM affinity/anti-affinity rules to maintain.
In regards to importing.. how can the import script attached here (previously in this thread, and in this message) be adapted to an environment that has different datacenters with the same cluster name. Exactly like the previous post in this thread with DataCenter1 & 2, and the associated cluster.
I am a bit confused as I am not sure if the datacenter name is captured in array, or if it is how to add it as a condition.
Appreciate any help.
The datacenter name is not in the export file, it needs to be added.
Could you perhaps attach the export script you are using ?
There are several variants in this thread
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I created 2 new scripts to do the export & import with inclusion of the datacenter.
Have a go at them.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
I have tested the Export Rules, and as far as I can tell it has grabbed all the rules in the different Datacenter / Clusters. (over 250 rules). I haven't yet tested the import rules will post once I do.
thanks again for providing these scripts, they are extremely helpful, and my skill set at current is far off from accomplishing this on my own.
No problem.
I forgot to mention, when you test the import it could be useful to first add the -WhatIf parameter to the New-DRSRule cmdlet.
That way PowerCLI will tell you what it is going to do without actually doing it.
Once you're happy, you remove the -WhatIf parameter.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The script needs an adjustment:
The line containing Get-DrsRule needs the following:
Get-DrsRule -Type VMHostAffinity