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
- drsConfig property in the ClusterDrsConfigInfo data 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 the ClusterDrsConfigInfo.enabled property.
- drsVmConfigSpec property in the
ClusterDrsVMConfigSpec
data object points to a
ClusterDrsVmConfigInfo
data object that specifies the DRS configuration for a single virtual machine.
ClusterDrsVmConfigInfo
overrides 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 call ComputeResource.ReconfigureComputeResource_Task and pass in a ClusterConfigSpecEx object. In the ClusterConfigSpecEx.drsVmConfigSpec property, you can specify an array of ClusterDrsVMConfigSpec objects that define the configuration for individual virtual machines.
- rulesSpec property in the ClusterRuleSpec data object points a ClusterRuleInfo data object that specifies the affinity and antiaffinity rules DRS should use. See the vSphere API Reference entry for ClusterRuleInfo.
- VMware HA – distributed
availability service (DAS)
- dasConfig property in the ClusterDasConfigInfo data 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 the vSphere API Reference.
- dasVMConfigSpec property in ClusterDasVMConfigSpec object, where the info property is a ClusterDasVmConfigInfo data 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 the dasConfig property for all virtual machines in the cluster.
- VMware HCI
- The ClusterComputeResourceHCIConfigInfo data 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.
- The ClusterComputeResourceHCIConfigSpec data 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 the ConfigureHCI_Task method, and reconfigure an HCI cluster with the ExtendHCI_Task method.