Creating a
Cluster
If your environment includes a vCenter
Server and multiple ESXi hosts, you can create a cluster by calling the
Folder.CreateClusterEx
method. You
pass in a name for the new cluster and a
ClusterConfigSpecEx
data object.
In the data object, you can specify the following properties:
- VMware DRS
- drsConfigproperty in theClusterDrsConfigInfodata object contains configuration information for the VMware DRS service. Properties in this object specify the cluster-wide (default) behavior for virtual machine and the threshold for generating cluster recommendations. You can enable and disable VMware DRS with theClusterDrsConfigInfo.enabledproperty.
- drsVmConfigSpecproperty in theClusterDrsVMConfigSpecdata object points to aClusterDrsVmConfigInfodata object that specifies the DRS configuration for a single virtual machine.ClusterDrsVmConfigInfooverrides the default DRS configuration for an individual virtual machine and allows you to specify the DRS behavior and whether DRS can perform migration or recommend initial placement for a virtual machine.To update a DRS configuration, you callComputeResource.ReconfigureComputeResource_Taskand pass in aClusterConfigSpecExobject. In theClusterConfigSpecEx.drsVmConfigSpecproperty, you can specify an array ofClusterDrsVMConfigSpecobjects that define the configuration for individual virtual machines.
- rulesSpecproperty in theClusterRuleSpecdata object points aClusterRuleInfodata object that specifies the affinity and antiaffinity rules DRS should use. See thevSphere API Referenceentry forClusterRuleInfo.
- VMware HA – distributed availability service (DAS)
- dasConfigproperty in theClusterDasConfigInfodata object specifies HA service on the cluster. Properties in this object determine whether strict admission control is enabled, what the default virtual machine settings in this cluster are, whether VMware HA restarts virtual machines after host failure, and so on. See thevSphere API Reference.
- dasVMConfigSpecproperty inClusterDasVMConfigSpecobject, where theinfoproperty is aClusterDasVmConfigInfodata object that specifies the HA configuration for a single virtual machine. You can apply different settings to different virtual machines, or use the default specified in thedasConfigproperty for all virtual machines in the cluster.
- VMware HCI
- TheClusterComputeResourceHCIConfigInfodata object contains properties to capture the configured hosts, virtual distributed switch settings, host configurations, and HCI workflow state. The HCI cluster includes vSphere facilities for DRS, HA, vMotion, and vSAN.
- TheClusterComputeResourceHCIConfigSpecdata object specifies the virtual distributed switch settings, host configurations, enhanced vMotion capability, and vSAN configuration.
- Once configurations are specified, you create an HCI cluster with theConfigureHCI_Taskmethod, and reconfigure an HCI cluster with theExtendHCI_Taskmethod.