DRS anti-affinity rules

Hello world

I want to create anti-affinity rules machine virtual-VM for 4 virtual machines. We use vSphere 4.0 U2 on our environment.

What would be the number of rules that are created on the DRS Cluster?

It's 6 rules? What is different now.

4 VMS = 6 rules (VM1/VM2 VM1/VM3 VM4/VM1, VM2/VM3, VM4/VM2, VM3/VM4)

gedelar wrote:

It's 6 rules? What is different now.

If you upgrade to vSphere 4.1, that one rule would be necessary, but I guess on 4.0, you must create these six different rules.

http://www.VMware.com/files/PDF/Techpaper/VMW-whats-new-vSphere41-HA.PDF

"Finally, rules anti-affinity machine VM-virtual can now integrate more than two virtual machines." Here, VMware DRS try remove the virtual machines specified. Users could use this rule to ensure that some virtual machines are always on different physical hosts. »

Tags: VMware

Similar Questions

  • Backup/restore DRS VM affinity/anti-affinity rules - can they be backed up and restored without re-entering manually after DRS disabled?

    DRS VM affinity/anti-affinity rules - these are lost when the DRS is off - they can be "listed" via perl or script Toolkit VI to return to manual if necessary.

    But can they be backed up / restored through automated methods for easy recovery in case required or accidental deactivation of the DRS? What happens if a user of vCenter turns off instead of the manual setting during operations?

    I have over 100 + VM DRS affinity/anti-affinity rules to maintain.

    There are indeed several DRS rules related cmdlets in the VITK 1.5.

    The following script will save all rules in a .txt file.

    $outfile = "C:\rules.txt"
    Remove-Item $outfile
    $clusterName = 
    $rules = get-cluster -Name $clusterName | Get-DrsRule
    
    foreach($rule in $rules){
      $line = (Get-View -Id $rule.ClusterId).Name
      $line += ("," + $rule.Name + "," + $rule.Enabled + "," + $rule.KeepTogether)
      foreach($vmId in $rule.VMIds){
        $line += ("," + (Get-View -Id $vmId).Name)
      }
      $line | Out-File -Append $outfile
    }
    

    The reason why we are writing the rules in a .txt file is because the type of 'Solidarity' with the rules can have 2 or more guests defined.

    This type of info (variable length table) is impossible to export to a. CSV file.

    The 2nd script reads this external file and sets the rules.

    $file = "C:\rules.txt"
    $rules = Get-Content $file
    
    foreach($rule in $rules){
      $ruleArr = $rule.Split(",")
      if($ruleArr[2] -eq "True"){$rEnabled = $true} else {$rEnabled = $false}
      if($ruleArr[3] -eq "True"){$rTogether = $true} else {$rTogether = $false}
      get-cluster $ruleArr[0] | `
        New-DrsRule -Name $ruleArr[1] -Enabled $rEnabled -KeepTogether $rTogether -VM (Get-VM -Name ($ruleArr[http://4..($ruleArr.Count - 1)|http://4..($ruleArr.Count - 1)]))
    }
    

    [The trick used for guests, it's that we select the part of a table with the \[a... scoring b\].

    Currently, you will need to run the first script for each cluster separately, but this could be easily adapted to run on all clusters in your VI.

  • Manual VMotion circumvents the rules of the DRS anti-Affinity

    Hello

    just a really Basic... I know DRS rests on the idea that he leans on the cluster and then resources place virtual machines... BUT, if you configure a rule anti-xxx to say VM1 cannot be kept the same host that VM2 - can I still manually vMotion VM1 to the same host only a VM02 on?

    OK... Let me rephrase that. After having just... I asked myself why I cannot vmotion 2 virtual machines to be on the same host, even if there is an anti-home rule?

    My hypothesis is one of the following:

    1. I have not configured the anti-home rule correctly, or

    2 DRS is a retrospective resource, monitoring tool. so he will ignore my action, but when it checks the environment, it will then search the vm 2 is on the same host and then applies the rule of the anti-xxx.

    Let me know that if you can...

    Thank you

    Aaron

    Welcome to the community - Yes, you can manually vmotion a virtual machine that would violate the rule of the affinity of the DRS but if you DRS in partially or entirely automatice mode it will vmotion virtual machine don't not to violate the anti-home rule.

  • Evacuation and binding affinity rules

    I have a 5.5 ESXi host called ESXi1 in a group of DRS host called "host of ESXi1 group.  No other ESXi host is in this group, but there are 4 other ESXi hosts in the cluster.  I have a VM called 'VM1' in a virtual machine DRS group called "group virtual machine VM1.  No other VMS are in this group of DRS.

    VM1-> "VM1-machine group.

    ESXi1-> "host of ESXi1 group.

    There is a mandatory rule of DRS that says MV in the 'machine VM1 group' working only with ESXi hosts in the 'host ESXi1 group'.  What happens when I try to put ESXi1 host in maintenance mode?  He will be able to evacuate VM1 since there is no other host in the Group VM1 to work?

    Yes. Answer is 100% correct. If configured VM host affinity/anti-affinity rule is ESSENTIAL, it cannot be violated. Same vSphere HA respects the rules of the VM-host must. Even you can not manually migrate this VM1 to another host. Maintenance mode also cannot assess the host. Even if there is imbalance CPU/Memory, DRS will always obey this rule.

    If you want this rule to be flexible, you can configure the same thing as "soft / should" rule. In this case, rule is violated every time that it is absolutely necessary (like MM, HA does not respect this rule, you can manually migrate VM to others, the DRS in a balanced cpu/memory can violet this rule) but notes that in the immediate following invocation of the DRS, DRS will try its best to resolve the violation of the rules.

    To know what are the rules can be honored by vSphere HA:of vSphere HA abreast of the DRS rules of affinity? | vThinkBeyondVM

    Let us know if you need any other clarity.

  • SQL 2012 still on the use of affinity rules

    Hey guys,.

    I use SQL 2012 alwaya time on in a virtual, but so far, it is not configured as best practices and environment I wanted to change that.

    At the moment I have no DRS rules in place so it can happen that two virtual machines running on the same host and it's something I want to avoid.

    However, my big problem is that I only got a SQL license for two hypervisors and best practices talked about four hosts who are needed to achieve my goal.

    Here is what I intend to implement:

    -Affinity rule machine virtual-VM to separate two virtual machines

    -Affinity VM host rule which VM1 MUST run on ESX1

    -Affinity VM host rule that VM2 MUST run on ESX2

    This configuration is a good idea or could / should I do something different?

    What I found that all the features how for example the evacuation and HA should still work?

    There are many more ESX servers in this group and they will be used in the case of an outtage, right?

    Also there is a dev environment that looks the same. I could include the hosts in the same VM-Host affinity rules or should I create new ones?

    BTW. I am using vCenter and ESX 5.5.0.

    Thank you very much!

    See you soon

    Nicolai

    Affinity rules those you intend to sense. These rules will not be those virtual machines to be on the same host most of the time.

    Note:

    1 rule of VM host is configured as "SHOULD", in extreme cases, DRS can break these rules. However, in the next invocation of DRS, DRS will try to resolve the violations.

    2. Note that: when you keep either the host in maintenance (ESX1 or ESX2) mode, you must manually migrate the VM to another host due to the virtual-VM anti rule machine affinity. DRS even in full auto mode, VM will not be migrated automatically. This will apply only if there are only 2 host in the cluster.

    3. Yes, HA should well with that: however HA is not aware of the rules 'EXPECTED' and in the case of host failure it can not respect 'SHOULD' rule.

    4 rule anti-affinite VM - VM can be sensitized HA using the advanced option. Let me know if you want to help with that.

    5. Yes, failure of other hosts in the cluster will be used but please updated on impact due to rules & licenses.

    6. "There is also an environment-dev which looks the same." I did not follow what exactly you mean here:

    7 migration threshold settings DRS is also important.

    8 DRS gives priority to the prevention of violations of anti-affinity rules machine virtual-VM that violations of rules of affinity. (it's just for your info.)

    Nevertheless,.

    1. If ESX1 falls down or affinity rule VM host that VM1 MUST run on ESX1 gets violated: VM1 can be migrated to other hosts in the cluster. As you have no licenses (more than 2) SQL, how it would be dealt with (I'm not very updated on the SQL licenses)

    2 point above applies to the second rule of VM HOST as well.

  • New-DrsRule - anti-affinite rule Max 2 VM

    Hi all

    I use vSphere PowerCli 4.1 for import and export of objects of vSphere and I was wondering if someone could give me the truth about the rules of the anti-Affinity DRS.

    Specifically, if the number of VM limit is always capped at two.

    The reason why I ask this is that when I try to create a rule anti-XXX for three VM from the command line with the following command:

    New-DrsRule-Cluster (Cluster-Get-name $DRSR.cluster)-name DRSR. Name - Enabled $True - KeepTogether $False - VM (VM - Get $DRSR.vms)

    I get the following error:

    New-DrsRule: 26/07/2011-15:30:24 New-DrsRule you must specify 2 or more VMs if KeepTogether option is set and only 2 virtual machines if KeepTogether option is not set.
    Online: 1 character: 12
    + New-DrsRule < < < <-Cluster (Cluster-Get-name $DRSR.cluster)-name DRSR. Name - Enabled $True - KeepTogether $False - VM (VM - Get $DRSR.vms)
    + CategoryInfo: InvalidArgument: (:)) [new DrsRule], VimException)
    + FullyQualifiedErrorId: Client20_ComputeResourceServiceImpl_TryValidateDrsRuleVMCount_InvalidVmCount, VMware.VimAutomation.ViCore.Cmdlets.Commands.NewDrsRule

    However, I am able to create the rule through vCenter.

    What I'm missing here? Is the rule that I create in vCenter not actually applied?

    Did he able to put me in stright?

    Thank you!

    Thank you.

    You are right, the New-DrsRule cmdlet when it is used for an anti-affinite rule limits the number of guests to 2.

    I suspect that this is for historical reasons.

    In environments of pre-version 4.1, I think it was indeed a limitation, even in the vSphere client.

    So yes, I'm afraid that you have to adapt the script to create anti-affinity rules 2 by 2.

    Fortunately, you can use a simple loop nested to create rules.

    Something like this for example

    $vms = "vm1","vm2","vm3","vm4","vm5","vm6"
    
    $j = 1 1..($vms.Count-1) | %{
        $i = $_    ($i - 1)..0 | %{
            New-DrsRule -Cluster (Get-Cluster -Name MyCluster) `        -Name ("Rule" + $j) `        -KeepTogether $false -VM (Get-VM -Name $vms[$i],$vms[$_])
            $j++    }
    }
    
  • Rule of DRS anti-affinite storage

    Hello

    We have vSphere 5.0 U3

    I applied the rule anti-affinite the couple to Exchange and Citrix servers.

    I want to know if this anti-affinite rules apply to all the configuration files for vmdk also. As I have my 2 Exchange VMDK servers on the same data store.

    Please help me understand. Also let me know how to configure the anti-affinite DTS rule.

    Thank you

    Mihir

    WG response.

  • Help determine the best anti-affinity configuration

    I'm starting to soak in the VM and host rules of affinity for the first time.  One of our clients is looking to have 30-40 MV spun up use for distributed processing.  They want to ensure that in the event of a host failure, they will also have few virtual machines down at any time.  It seems that we should be able to use rules anti-affinity vm to achieve this goal to force them to be distributed evenly across all hosts in the cluster.

    I've not had much luck tracking examples of scenarios, so I had a few questions about how it would work.  I thought create a single rule anti-affinity VM and put all the VMS of 30-40 in there.  I guess, from what I've read, that he would do his best to satisfy the rule balancing on all hosts, although this can mean 2 virtual machines exist on the same host.  Would this work?  This would cause alerts or errors, if we had several virtual machines as the hosts?  Or I have to configure several rules to allow it works without error.

    Affinity VM rules would make the most sense here, or affinity host rules would be relevant here, and we would be preferred over the other?

    Thank you.

    It's one of the paramets when creatung rule will solve this dilemma - you need to set the value specification 

    Not run on hosts in a group that will keep separate virtual machines but allowing them to run on the same host if necessary-

  • HA and affinity rules &amp; book by Duncan &amp; Frank

    VMware vSphere reading 5 clusters of Duncan & Frank (Pocket v1.0) deepdive, I'm confused.

    On page 212, second paragraph, it says (roughly) VMware HA is not aware of the virtual-VM anti machine affinity rules, and after an HA event may begin on the same host. But on page 215, second paragraph, it says (roughly) HA will not violate the mandatory rules after HA failover.

    This seems to contradict itself.

    I can not type the full section due to copyright.

    Is anyone able to explain it?

    See you soon.

    Hello

    There are two types of rules:

    1. VM - VM affinity rules
    2. VM - host affinity rules

    HA is not aware of the first, machine virtual-VM, so any rule you create here will be ignored by HA.

    Now, for the second, it's a bit more complicated... There are two types of VM - affinity host rules:

    1. Bride aka mandatory
    2. Expected preferential aka

    HA will respect 'must' of the rules, but will be no respect for the rules 'should '.

    That's what means the book.

  • Affinity rules

    What are the "rules of affinity".

    Thank you

    Prashant

    Affinity rules you can define a rule for example that a specific virtual machine only works on a single host (you choose). Or the other way around: one or more virtual machines are not allowed to run on host A & B for example.

    This is often used in combination with license policies.

    Kind regards

    Mario

  • Automate adding to DRS affinity rule

    Is it possible to add automatically as a new virtual machine created in a specific to his Rule DRs Cluster?

    Here we have 2 rules of affinity in the same cluster and all VMV that would be created it needs to adhere to a rule.

    To change the rule:

    game-drsrule-rule (get-drsrule-cluster (cluster-get "Mycluster") - name "MyRule")-VM $MyVM - Enabled $true

    Everything is possible with PowerCLI

    Seriously, you want to detect the virtual machines in a cluster that are not in a rule of DRS, correct?

    When you detect VMs DRS article they should be added?

  • There are advanced settings for VM - VM affinity rules?

    Hello world

    First time post, but I have found extremely useful forums in search engine results so thought I should get involved as much as I can.

    Anyway, I was asked a question about the rules of affinity, and I was not able to find the answer anywhere, so I was hoping someone might be able to point me in the right direction please.

    My client gave me a list of VMs that are 'pairs' - by that I mean that they both the same, but act is turned on and the other is used only if the virtual direct machine is not reachable. There is nothing intelligent power which, as grouping or well HA within the OS.

    We asked me to make sure the pair of VM could not be fed by the same ESXi host, thus following the documentation for VMware, I created a virtual-VM affinity DRS machine rule. I was asked to test it, and honestly, it works a treat. However, the result is not desired. Unfortunately, I can not give too much information because of policies, but I'll try my best to explain the whole upward and deliver.

    The rule stops two virtual machines are hosted on the same ESXi host at

    VM1 is the direct server, VM2 is the backup server

    Both of the above are in the relevant rule

    There are 8 hosts in the cluster

    HA and DRS are enabled on the cluster

    ESXi version 4.1

    If I manually start a vMotion VM2, send to the host who currently hosts VM1, it seems to happen: VM2 vMotion gets 78% > > DRS Rules are evaluated > > VM1 is vMotion had to a new host > > VM2 vMotion ends when VM1 is off the host

    However, I am told that the customer would have preferred that the VM2 vMotion fails, or the vMotion process automatically sends elsewhere, rather than invoke a VM1 vMotion.

    I'm not quite sure what is happening in the case of a real event of HA, I'm sure I read that HA not take account of the DRS Rules? The foregoing only happens because it is a manual vMotion? Or y at - it a better method that I forgot?

    Thank you

    Paul

    Unfortunately, as you use vSphere4.1, you're out of look about the DRS control over an HA event, it's a feature of 5.x

    If you do a manual vMotion then you are effectively denying your rules of affinity of DRS, until she physically check the rule during the migration.  It's as good as it gets.

  • Two virts never share the same host... What are my options?

    Hi all

    Ive got two virts which are nearly identical and work in an active/active load. What are the options I have to ensure that these two virts never end up on the same physical host?

    I'm not looking for FT. I'll have two functional virts at the same time.

    Thank you!

    You can do this by setting VM - VM DRS anti affinity rules.

    André

  • Rules anti-of affinity DRS VM - VM in vSphere 5.5

    Does anyone know what is the advanced option which allows the HA to comply with the anti-affinity rule machine virtual-VM in vSphere 5.5? It is mentioned as an improvement in this 5.5 vSphere document new features: http://www.vmware.com/files/pdf/vsphere/VMware-vSphere-Platform-Whats-New.pdf

    "To meet the need to maintain the placement of virtual machines on different hosts - without migration vMotion, vSphere - after a failure of the host, vSphere HA in vSphere 5.5 has been improved in order to comply with the rules antiaffinity machine virtual-virtual machine. Application availability is maintained by controlling the placement of virtual machines recovered by vSphere HA without migration. This feature is configured as an Advanced option in vSphere 5.5 "

    In previous versions, if you want to keep 2 VMS separated event HA, the recommendation was to create "" must run on hosts in the Group"rules of VM-host affinity with 2 virtual machines in different groups of DRS VM." "

    There was also the DRS ForceAffinePoweron advanced option, but it is not actually applied HA event.

    Thank you.

    I found the answer on the blog of Duncan Epping:

    http://www.yellow-bricks.com/2013/09/04/vSphere-5-5-nuggets-high-availability-enhancement/

    das.respectVmVmAntiAffinityRules - values: (default) ' false' and 'true '.

    Thanks Duncan!

  • 5.5 HP u2 - rules tab seems to be missing some options

    Hello.

    I remember that I used to be able to add host (Dungeon vms on the single host) affinity rules.

    I just went of for again (the last time maybe a year ago) and I'm not able to determine how do.

    I followed the instructions of vmware and the internet operating instructions and it seems that I am part missing

    Rules tab options.

    My rules tab is attached as an image.

    I compared with that which is at: http://www.gabesvirtualworld.com/wp-content/uploads/2011/02/2011-02-24_214520.jpg

    One of the many sets of instructions, I'm following is: KB VMware: affinity or a DRS anti-affinite rules are not applied during a virtual machine market

    I don't know if I'm following the instructions on the right or missing from my HP 5.5 U2 ESXi build something.

    Thank you

    As far as I know, there is nothing which changed by OEMs like HP basic functionality.

    What options you see when you open the menu drop-down?

    André

Maybe you are looking for