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++    }
}

Tags: VMware

Similar Questions

  • 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.

  • 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.

  • 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. »
  • the new drsrule problem

    I'm looking to set up the DRS to separate the Nexus switches. I can do that by using the following code, however, is a problem where if I put as a scheduled task every iteration will create the rule of the DRS and so on and so on, even if it already exists. I was wondering if there was a better way to go about this? I appreciate it.

    $clusters = get-cluster

    foreach ($cluster in $clusters)
    {

    new-drsrule-cluster ($cluster | where {$cluster - notmatch "test *"})-name Nexus - keeptogether $false - VM * testn1k * - runasync - erroraction silentlycontinue

    }

    Why don't test you if the rule already exists and only create the rule when it is not.

    Like this

    $clusters = get-cluster | where {$_.} {Name - notmatch "test *"}

    foreach ($cluster in $clusters)
    {

    If (!) () Get-DrsRule-name $cluster - ErrorAction SilentlyContinue Nexus-Cluster)) {}

    new-drsrule-cluster $cluster - name Nexus - keeptogether $false - VM * testn1k * - runasync - erroraction silentlycontinue

    }

    }

  • Anti-affinite machine virtual-VM and HA


    If I have a 2 host cluster and two virtual machines with a rule of DRS Dungeon-apart, what will happens to those virtual machines in the event of a host failure?

    Hello

    vSphere 5.1 HA will ignore the rule and restart the virtual machine anyway.

    vSphere 5.5 has a new advanced parameter called 'das.respectVmVmAntiAffinityRules' which raise rule affinity HA VM - VM. This setting would result in your VM beeing not restarted on the second host.

    Concerning

    Tim

  • Customize new to Jdeveloper audit rule

    Dear all,

    Hi any body knows how to create a new audit rule customize in Jdeveloper.For example, each parameter must be start with p.

    Please any guide for me or provide a sample one...

    ] public void add (String pName, String City)
    {
    .......
    .......
    ......
    }


    JDev version: 11.1.1.5.0


    Thank you
    Jean-Marc Mithra

    A couple of blog entries on the creation of audit rules:
    http://blogs.Oracle.com/jdevextensions/entry/don_t_fear_the_audit
    http://blogs.Oracle.com/jdevextensions/entry/don_t_fear_the_audit1

  • Need to create a new record with the rules of the takeover bid

    Hi all

    I want to create a new record with OPA according to the result value (Service request is valid)

    For example
    When the demand for services is valid if
    There are (the activity is valid)
    the activity is valid if
    activity type = 'other '.

    Can someone help me how to

    Can you provide a little more information on what you want to do?

    If you want to create an object in, for example, a database based on the results of the OPA assessment or investigation, then that lies outside of the OPA and is usually performed by the client that calls the rules.

    If you want to create an instance of entity within the am Session OPA, then this will be involved custom code. There is an example of this in the OPA 10.2.0 documentation, see: example: enter into instances of entity with an inference listener in policy of Automation Developer Help. It is available online at http://download.oracle.com/docs/html/E20344_01/toc.htm

  • New conditions for coding rules

    Specifically, I want to change the conditions of the rule for the use of the Machine virtual memory add a time element. I want to be notified if the memory threshold has been passed for more than 10 minutes, critical to more than 20 and fatal in more than 30 years.
    I was able to make simple changes to other conditions, but for this I need some documentation in-depth on conditional language and available data. The rules of grammar, I'd be fine with; This is how to get the data over a specified period of time that I'm stuck.
    Thank you.

    Hi James,
    You can adjust in the rule on the behavior tab. You can have fire alarm if the condition has been present for some time.
    This may not work exactly as you want, but I think that it will achieve the same result.
    Check that out and let me know if it works.
    Thank you
    -dave

  • Emails of New Smartphones blackBerry with rules ordering specific folders does not download

    I just got my BB through the company and we have problems of implementation of e-mail. The company has a BES server and uses the Outlook of business e-mail. The problems are with the download of e-mail that has been redirected by a rule in Outlook to a folder inside the Inbox.

    So far, I loaded the Blackberry Desktop and configured the setting of e-mail on the Advanced tab to redirect the files sampled and selected all records. I double checked the settings in the tab options and are stored on the device. I still do not receive e-mail if the address has a rule to one folder other than the Inbox.

    I am sure there is a setting somewhere, but have not found.

    Help!

    Thanks in advance,

    By default, a BlackBerry will reconcile only (DON'T Synchronize) with the Inbox.  You must enable the Folder Redirection for each folder that you want to be able to see email coming in on your BlackBerry.

    1. From the home screen, go to Messages, then click on the [Menu] (button to the left of the trackball) button or scroll wheel , and then select Options--> e-mail settings.
    2. On the e-mail settings screen, click on the scroll wheel or [Menu] button and select The Folder Redirection.
    3. Top of the screen, you will see your mailbox with a + to the left of it.  With your mailbox highlighted, click on the wheel or the [Menu] button and select expand.
    4. You should now see all e-mail folders in your mailbox, including your Inbox.  Note that the checkbox to the left of the Inbox is verified or filled (depending on your operating system and the theme).  This indicates that the BES server redirects email arriving in this folder to your BlackBerry.
    5. Subfolders located under a folder that you see are indicated by a + to the left of the folder.  Select the line and Expand (see above) to display subfolders.
    6. Any redirected folder will be a box filled or enabled to the left of it.  To activate the redirection of a folder which is not filled or saved, highlight the line of the file and press [space]
    7. When you are finished, [Esc] (button to the right of the trackball) or the button below the scroll wheel and select Save.

    Further, mail arriving in checked or completed records now appears in the list of Messages.  You will notice that the icon of these emails is a folder instead of an envelope.

    As suggested above, you will not see ANY e-mail that has already been received in your mailbox on your BlackBerry.  This is because the BlackBerry is not sync, but rather sends an e-mail once and then follows the changes in the status of messages.  To get any email on your BlackBerry, simply send to yourself of your e-mail application.

  • 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é

  • Clusering SQL 2012 on ESX 5.1

    Hello

    Can someone tell me the current state of Microsoft Cluster Services with Vmware Esxi 5.1? This link says that it supports HA and DRS:

    VMware KB: Microsoft Clustering on VMware vSphere: guidelines for supported configurations

    This link says that it is not:

    http://pubs.VMware.com/vSphere-51/index.jsp?topic=%2Fcom.VMware.vSphere.MSCS.doc%2FGUID-6BD834AE-69BB-4d0e-B0B6-7E176907E0C7.html

    I'm looking through availability of AlwaysOn SQL on a 5.1 ESXi cluster groups and want to confirm the status of HA and DRS support on this cluster? My availability of AlwaysOn SQL group won't use shared storage (witness file share that will be used), but it is always based on the Microsoft Clustering Services. I think to create 2 WindowsServer 2012 SMV, Setup Windows clustering services with haste VMDK thick set to zero (no RDM), on a cluster HA and DRS activated, but DRS and HA disabled for my cluster of virtual machines. This is a supported scenario?

    It would be good to hear from people who have something similar.

    Thank you

    Follow the article. With your Setup program that do not rely on the shared disk, SQL 2012 VM in the AlwaysOn Availaibity group will be just an another VM and can be protected by HA. It can also use vMotion and DRS.  Just install anti-affinites rules to make sure that the SQL VM do not sit on the same ESXi host.

    Added information here http://www.vmware.com/files/pdf/solutions/SQL_Server_on_VMware-Availability_and_Recovery_Options.pdf

  • SLES + OCFS2 shared physical RDM

    I intend to install a cluster node Linux SLES OCFS2 using a RDM in physical mode 3.

    I did this once before with both VM and set bus SCSI physical Division on the 1st virtual machine, and then for the 2nd server selected the 1st mapping VMDK file. This gave the desired effect to allow the physical RDM to be shared, but meant that vMotion was not possible for one of these two servers.

    What I intend to do this time is to configure all the same VM 3, everyone has the physical RDM attached without bus sharing together on the SCSI bus.  This is possible, I think that, by setting config.vpxd.filter.rdmFilter to false before you add the ROW to each virtual machine. Then the anti-affinites rules will be set to stop 3 VM running on the same host. This should allow the sharing of the RDM OCFS2 and vMotion of virtual machines.

    I think it will work. Can someone tell me if there are problems with it? Is this a supported configuration?

    Thank you

    Neil.

    More than 2 nodes is not supported by VMware. OCFS2 supports more than two nodes. It has been popular with Oracle RAC, until everyone has opted for the DSO. While VMware does exactly what the no-MSCS Clustering support or requirements are. Most of the things are based on the limitations of MSCS clusters in VMware. I am about to implement a number of clusters for a customer with OCFS2, but will be limited to two nodes. We were just will you use FT for our high availability needs, but with the guest operating system as a single point of failure have failed to meet application SLAS.

  • 2 cluster nodes does not work on the same esx host

    Hello

    I would like to know how it is possible for 2 VM (a cluster of application) cannot run on the same esx (for example: only 2 esx in a cluster and an esx crash!)

    Thank you

    Concerning

    You must configure the properties of the DRS cluster to add a new regulation anti-affinite.

    See cluster / properties / DRS

    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!

Maybe you are looking for

  • Thunderbird says it can't find the records that my message filters use and are present in the list of folders.

    The error message reads: The record [which] is not found, then the filters associated with this file will be disabled. Verify that the folder exists, and that the filters to point to a valid destination folder. If I manually edit the disabled message

  • Several video projects on DVD

    Compressor Ver 4.2.2 have the ability to burn two or more FCP video projects on DVD, assuming that there is enough space? Compressor Ver 4.2.2 allows to burn a DVD with video to iMovie? I have an iMac, mid 2011, OS X El Capitan, worm 10.11.4. Thank y

  • Recovery BIOS code

    Have a HP Mini 110-1046NR S/N: CNU0075D1K, have not used for a few months. Request a password I don't remember, I guess than her for the BIOS. 'Enter the current password' is what I see. How to reset?

  • Which product do I need?

    I have a router (WRT54GS) wireless in place already to provide access to my laptop.  It was a good Christmas - now, I have a Blue Ray of the Cabinet a Wii and another PC who needs internet access.  All of the new devices are close together, but as a

  • Personalized message in the Connection class

    HelloCan I set a custom message for each connection that I use?I want to keep the last query executed for all of my DB connections.I tried to use setClientProperties, but I can use only a few custom touches.I use BoneCP.Thank you.