vim_drs_rule¶
Cluster DRS affinity / anti-affinity rules via SOAP.
Three rule kinds:
VM-VM affinity (
vim.cluster.AffinityRuleSpec) — keep VMs togetherVM-VM anti-affinity (
vim.cluster.AntiAffinityRuleSpec) — keep VMs apartVM-Host (
vim.cluster.VmHostRuleInfo) — bind/exclude a VM group to/from a host group
Rules are mutated through ClusterComputeResource.ReconfigureComputeResource_Task
with a vim.cluster.ConfigSpecEx containing rulesSpec operations.
Rule identity:
pyVmomi servers assign a stable
key(int) to each rule.A separate
nameis the human-readable label. Names are unique within a cluster on practical deployments; we use it as the lookup key.
- saltext.vcf.clients.vim_drs_rule.list_(opts, cluster, profile=None)[source]¶
Return every DRS rule on cluster as a list of dicts.
- saltext.vcf.clients.vim_drs_rule.create_vm_affinity(opts, cluster, name, vm_moids, enabled=True, mandatory=False, profile=None)[source]¶
Create a VM-VM affinity rule keeping vm_moids on the same host.
- saltext.vcf.clients.vim_drs_rule.create_vm_anti_affinity(opts, cluster, name, vm_moids, enabled=True, mandatory=False, profile=None)[source]¶
Create a VM-VM anti-affinity rule keeping vm_moids on different hosts.
- saltext.vcf.clients.vim_drs_rule.create_vm_host(opts, cluster, name, vm_group_name, host_group_name, affine=True, mandatory=False, enabled=True, profile=None)[source]¶
Create a VM-Host rule binding vm_group_name to host_group_name.
affine True means runVmOnHost; False is runVmAvoidHost.
- saltext.vcf.clients.vim_drs_rule.update(opts, cluster, name, enabled=None, mandatory=None, vm_moids=None, profile=None)[source]¶
Modify an existing rule’s enabled/mandatory flags and/or its VM set.
Only fields that are not
Noneare touched. Returns the updated rule dict.