Cluster Compute Resource Find Rules For Vm

Cluster Compute Resource Find Rules For Vm
Finds all enabled and disabled VM-VM Affinity and Anti-Affinity rules, involving the given Virtual Machine.

Finds all enabled and disabled VM-VM Affinity and Anti-Affinity rules, involving the given Virtual Machine.

Required privileges: System.View

Request
URI
POST
https://{vcenter-host}/sdk/vim25/{release}/ClusterComputeResource/{moId}/FindRulesForVm
COPY
Path Parameters
string
moId
Required

The unique identifier for the managed object to which the method attaches; the serialized managed object reference for a request has the form moType/moId, in this case ClusterComputeResource/{moId}.

string
release
Required

The vSphere release schema. The current specification covers vSphere 9.1.0.0 APIs.


Request Body
FindRulesForVmRequestType of type(s) application/json
Required

Show optional properties

{
    "vm": {}
}
{
    "vm": {
        "_typeName": "string",
        "type": "string",
        "value": "string"
    }
}
vm
Required

The vm whose rules need to be looked up.

Authentication
This operation uses the following authentication methods.
Responses
200

OK

[
    {
        "_typeName": "string",
        "key": 0,
        "status": "string",
        "enabled": false,
        "name": "string",
        "mandatory": false,
        "userCreated": false,
        "inCompliance": false,
        "ruleUuid": "string"
    }
]
array of object
Optional

The ClusterRuleInfo data object is the base type for affinity and anti-affinity rules.

The affinity and anti-affinity rules are DRS (Distributed Resource Scheduling) rules that affect the placement of virtual machines in a cluster. Hosts and virtual machines referenced in a DRS rule must be in the same cluster.

Note: DRS rules are different than an individual host's CPU affinity rules (VirtualMachineAffinityInfo).

The Server uses DRS rule objects to describe the current rule configuration (ClusterConfigInfoEx.rule). Your client application uses rule objects to configure the affinity and anti-affinity rules (ClusterConfigSpecEx.rulesSpec).

You can create the following types of rules:

  • An affinity rule defines a set of virtual machines that should run on the same host. The ClusterAffinityRuleSpec object describes a rule that identifies virtual machines, but does not identify any specific host.
  • An anti-affinity rule defines a set of virtual machines that should run on different hosts. The ClusterAntiAffinityRuleSpec object describes a rule that identifies virtual machines, but does not identify any specific host.
  • A VM-Host rule defines affinity and anti-affinity relationships between virtual machines and hosts. The ClusterVmHostRuleInfo object describes a rule that identifies a virtual machine group (ClusterVmGroup) and affinity and anti-affinity host groups (ClusterHostGroup).

Rule configuration is a dynamic process. When you create or modify a DRS rule, the Server applies the rule to the cluster. If the existing cluster configuration violates the rule, the Server attempts to correct the situation. If that is not possible, the Server generates a fault and produces a log event. DRS rules do not have precedence; all rules are applied equally. DRS does not validate one rule against another. If you create conflicting rules, the older rule takes precedence and DRS disables the newer rule.

Improperly used, DRS rules can fragment the cluster and inhibit the proper functioning of DRS, HA, and DPM services. vSphere services never take any actions that would result in the violation of mandatory DRS rules. An operation that violates a mandatory rule would produce the following consequences.

  • DRS does not evacuate virtual machines to place a host in maintenance mode.
  • DRS does not place virtual machines for power-on or load balance virtual machines.
  • HA does not perform failovers.
  • DPM does not optimize power management by placing hosts into standby mode.

To avoid these situations, exercise caution when creating more than one mandatory rule, or consider using only optional rules. Make sure that the number of hosts with which a virtual machine is related by affinity rule is large enough that losing a host does not prevent the virtual machine from running.

For manual and partially automated DRS clusters, the Server produces migration recommendations to satisfy the DRS rules. You are not required to act on the recommendations, but the Server maintains the recommendations until the rules are satisfied.


Code Samples
COPY
                    curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '{"vm":"{}"}' https://{api_host}/sdk/vim25/{release}/ClusterComputeResource/{moId}/FindRulesForVm
                
Virtual Infrastructure Operations
POST
Cluster Compute Resource Abandon Hci Workflow
POST
Cluster Compute Resource Add Host Task
POST
Cluster Compute Resource Apply Recommendation
POST
Cluster Compute Resource Cancel Recommendation
POST
Cluster Compute Resource Configure HCI Task
POST
Cluster Compute Resource Destroy Task
POST
Cluster Compute Resource Disable Network Boot Task
POST
Cluster Compute Resource Enable Network Boot Task
POST
Cluster Compute Resource Cluster Enter Maintenance Mode
POST
Cluster Compute Resource Evc Manager
POST
Cluster Compute Resource Extend HCI Task
POST
Cluster Compute Resource Find Rules For Vm
POST
Cluster Compute Resource Get Resource Usage
POST
Cluster Compute Resource Get System V Ms Restricted Datastores
Deprecated
POST
Cluster Compute Resource Move Host Into Task
POST
Cluster Compute Resource Move Into Task
POST
Cluster Compute Resource Place Vm
POST
Cluster Compute Resource Recommend Hosts For Vm
Deprecated
POST
Cluster Compute Resource Reconfigure Cluster Task
Deprecated
POST
Cluster Compute Resource Reconfigure Compute Resource Task
POST
Cluster Compute Resource Refresh Recommendation
POST
Cluster Compute Resource Reload
POST
Cluster Compute Resource Rename Task
POST
Cluster Compute Resource Retrieve Das Advanced Runtime Info
POST
Cluster Compute Resource Set Crypto Mode
POST
Cluster Compute Resource Set Custom Value
POST
Cluster Compute Resource Stamp All Rules With Uuid Task
POST
Cluster Compute Resource Validate HCI Configuration
GET
Cluster Compute Resource Get Action History
GET
Cluster Compute Resource Get Alarm Actions Enabled
GET
Cluster Compute Resource Get Available Field
GET
Cluster Compute Resource Get Config Issue
GET
Cluster Compute Resource Get Config Manager Enabled
GET
Cluster Compute Resource Get Config Status
GET
Cluster Compute Resource Get Configuration
Deprecated
GET
Cluster Compute Resource Get Configuration Ex
GET
Cluster Compute Resource Get Custom Value
GET
Cluster Compute Resource Get Datastore
GET
Cluster Compute Resource Get Declared Alarm State
GET
Cluster Compute Resource Get Disabled Method
GET
Cluster Compute Resource Get Drs Fault
GET
Cluster Compute Resource Get Drs Recommendation
Deprecated
GET
Cluster Compute Resource Get Effective Role
GET
Cluster Compute Resource Get Environment Browser
GET
Cluster Compute Resource Get Hci Config
GET
Cluster Compute Resource Get Host
GET
Cluster Compute Resource Get Lifecycle Managed
GET
Cluster Compute Resource Get Migration History
GET
Cluster Compute Resource Get Name
GET
Cluster Compute Resource Get Network
GET
Cluster Compute Resource Get Network Boot Mode
GET
Cluster Compute Resource Get Overall Status
GET
Cluster Compute Resource Get Parent
GET
Cluster Compute Resource Get Permission
GET
Cluster Compute Resource Get Recent Task
GET
Cluster Compute Resource Get Recommendation
GET
Cluster Compute Resource Get Resource Pool
GET
Cluster Compute Resource Get Summary
GET
Cluster Compute Resource Get Summary Ex
Deprecated
GET
Cluster Compute Resource Get Tag
GET
Cluster Compute Resource Get Triggered Alarm State
GET
Cluster Compute Resource Get Value