VMware Cloud Community
DennieTidwell
Enthusiast
Enthusiast
Jump to solution

Backup/Restore DRS VM affinity/anti-affinity rules - can these be backed up and restored without manually re-entering after DRS disable?

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.

Reply
0 Kudos
26 Replies
jlewko98
Contributor
Contributor
Jump to solution

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.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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 Smiley Wink

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
jlewko98
Contributor
Contributor
Jump to solution

LucD,

The export file I am using is attached. Been trying to get the export script to cycle through the vCenter Datacenters and their associated clusters, but don't have a working script yet, so the export file is pretty straight forward.

Thanks.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
jlewko98
Contributor
Contributor
Jump to solution

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.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
nlopezs
Contributor
Contributor
Jump to solution

The script needs an adjustment:

The line containing Get-DrsRule needs the following:

Get-DrsRule -Type VMHostAffinity

Reply
0 Kudos