The vSphere Web Services SDK includes objects and methods for all cluster management tasks. Some documentation is available in the API Reference. For additional background and details about the failover and load balancing behavior, see the Resource Management Guide and the High Availability Guide.If your environment includes a vCenter Server system and multiple ESX/ESXi hosts, you can create a cluster by calling the Folder.CreateCluster method. You pass in a name for the new cluster and a ClusterConfigSpec data object. In the data object, you can specify the following properties:
■ dasConfig – ClusterDasConfigInfo data object that specifies the HA service on the cluster. Properties on 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 API Reference.
■ dasVMConfigSpec – ClusterDasVMConfigSpec object. ClusterDasVMConfigSpec.info 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.
■ drsConfig – ClusterDrsConfigInfo data object that 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 – ClusterDrsVMConfigSpec data object that points to a ClusterDrsVmConfigInfo data object which 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.When you update a DRS configuration, you call ComputeResource.ReconfigurComputeResource_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 – ClusterDrsRuleSpec data object that points a ClusterRuleInfo data object which specifies the affinity and antiaffinity rules DRS should use. See the API Reference entry for ClusterRuleInfo.
■ ClusterComputeResource.AddHost_Task – Adds a host to a cluster. The host name must be either an IP address, such as 192.168.0.1, or a DNS resolvable name. If the cluster supports nested resource pools and you specify the optional resourcePool argument, the host's root resource pool becomes the specified resource pool, and that resource pool and the associated hierarchy is added to the cluster.
■ ClusterComputeResource.moveHostInto_Task moves a host that is in the same datacenter as the cluster into the cluster. If the host is already part of a different cluster, the host must be in maintenance mode.
■ ClusterComputeResource.moveInto_Task works like moveHostInto_Task, but supports an array of hosts at a time. When using this method, you cannot preserve the original resource pool hierarchy of the hosts.You can reconfigure a cluster by calling the ClusterComputeResource.ReconfigureCluster_Task method. The method allows you to enable or disable VMware DRS or VMware HA and to define attributes. See Creating a Cluster.
■ ClusterComputeResource.MoveHostInto_Task or MoveInto_Task—Removes a host from a cluster and moves the host into another cluster. See Adding a Host to a Cluster.
■ Folder.MoveIntoFolder_Task—Removes a host from a cluster and make it a standalone host.
■ Host.Destroy_Task—Removes a host from inventory.