Deep Dive on Datastore Cluster Anti -Affinity Rules.

I have configured datastore cluster with name DatastoreCluster-1 in my Test Lab.

I have two ESXi hosts which are part of HA cluster.
I have added two datastores which are created on ISCSI LUNs. Each datastore is having only single instance.

Now as part of pratice I though of applying Storage DRS Anti-Affinity Rules :

These are basically of two types.
1) Inter-VM Anti-Affinity Rules : It applies at VM level that whether VM should be kept on same datastore or not.
2) Intra-VM Anti-Affinity Rules : It applies at Virtual Disk level that are associate with particular Virtual machine.

In the first screenshot I am showing that currently two VMs are hosted in DatastoreCluster-1. If you see both VMs are using

ISCSIDataStore-2.

FirstPicture

Scenario 1 : Inter-VM Anti-Affinity Rules

Now I have created Inter-VM Anti-Affinity Rule : So that these two VMs should be hosted on different Datastores.

It can be created using below Wizard.

Selecting Datastore Cluster –> Manage –> Settings –> Under configuration –> Select Rules –> Click Add –> Type the name of rule and Select VM anti-affinity –> Click Add –> Select two VMs(On which you want to apply rule) –> Save

After that I went to path shown in screenshot and click on “Run Storage DRS Now”. It shows me recommendation as per the rule.

Second Picture
You can apply the recommendation and if you want you can override the Storage DRS recommendation

After applying recommendation Storage migration started from data store ISCSIDataStore-2 to another ISCSIDataStore-1. It will take some time as soon as it get completed you will see that redhat-2 is running on ISCSIDataStore-1

Scenario 2 : Intra-VM Anti-Affinity Rules

I am adding new vmdk to redhat-2 because for Intra-VM anti-affinity rules VM should have atleast 2 disks.

While adding second rule as shown in screenshot. I am facing the challenge because it is conflicting with first one.
Now we have two ways to overcome the situation.
1) Add new datastore into cluster
2) Delete the previous rule.

Third Picture

In this case I am deleting the previous rule and then again trying to add this rule.

Still I was getting error because as per the VM overrides setting all VMDK for one VM should lie on same datastore.
I change the “Keep VMDKs Together setting from Yes to No”

Fourth Picture

After that was able to create Rule.

Click the “Run Storage DRS Now”. After that It shows me the recommendation we can apply that to move the vmdk from datastore to another.

Fifth Picture

Bonus Tip if you want to ignore all affinity rules during putting datastore in maintenance then add this setting in it. We can add the Advanced setting in Configuration Parameters.

Sixth Picture

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s