CreateCluster function (clusapi.h)

Creates and starts a cluster. The cluster consists of the set of nodes specified, with the Network Name, IP Address, and quorum resources if specified. The PCLUSAPI_CREATE_CLUSTER type defines a pointer to this function.


HCLUSTER CreateCluster(
  [in]           PCREATE_CLUSTER_CONFIG           pConfig,
  [in, optional] PCLUSTER_SETUP_PROGRESS_CALLBACK pfnProgressCallback,
  [in, optional] PVOID                            pvCallbackArg


[in] pConfig

Address of a CREATE_CLUSTER_CONFIG structure containing configuration information about the cluster to be created.

[in, optional] pfnProgressCallback

Address of callback function that matches the PCLUSTER_SETUP_PROGRESS_CALLBACK function pointer that will be called periodically to provide progress on the cluster creation.

[in, optional] pvCallbackArg

Argument for the callback function.

Return value

Handle to the newly created cluster or NULL. A non NULL value does not indicate complete success (all nodes will have been added, but not all IP Address or Network Name resources may have been created. The parameters passed to the function pointed to by the pfnProgressCallback parameter should be checked.

Return code Description
Less than a majority of nodes were successfully created. For more information about the error, call the function GetLastError.


The PCLUSAPI_CREATE_CLUSTER type defines a pointer to this function and can be used with the GetProcAddress function to call this function.

After the CreateCluster function successfully completes, at least 30 seconds should be allowed before the AddClusterNode function is called to add additional nodes.

The CreateCluster function successfully completes after cluster quorum has been achieved. One or more cluster nodes could be in a ClusterNodeDown or ClusterNodeJoining state for a few seconds.

Before calling the CreateCluster function, the CoInitializeEx function must be called specifying both COINIT_MULTITHREADED and COINIT_DISABLE_OLE1DDE for the dwCoInit parameter, as shown in the following code.



Minimum supported client None supported
Minimum supported server Windows Server 2008 Datacenter, Windows Server 2008 Enterprise
Target Platform Windows
Header clusapi.h
Library ClusAPI.lib
DLL ClusAPI.dll

See also



Cluster Management Functions