AddClusterResourceDependency function (clusapi.h)
Creates a dependency relationship between two resources. The PCLUSAPI_ADD_CLUSTER_RESOURCE_DEPENDENCY type defines a pointer to this function.
Syntax
DWORD AddClusterResourceDependency(
[in] HRESOURCE hResource,
[in] HRESOURCE hDependsOn
);
Parameters
[in] hResource
Handle to the dependent resource.
[in] hDependsOn
Handle to the resource that the resource identified by hResource should depend on.
Return value
If the operation succeeds, it returns ERROR_SUCCESS (0).
If the operation fails, AddClusterResourceDependency returns one of the system error codes. The following are possible return values.
Return code/value | Description |
---|---|
|
A resource depends on itself. |
|
The resource dependency already exists. |
|
The dependent resource is the quorum. |
|
The resources are not in the same group. |
|
At least one of the resources is marked for deletion. |
|
The dependent resource is already online. |
Remarks
A dependency relationship created by the AddClusterResourceDependency function affects how resources are moved from one node to another after a failure. It determines the order in which resources are taken offline and brought back online.
Resources in a dependency relationship must be moved together. The dependent resource must be brought online after the resource upon which it depends.
The two resources identified by hResource and hDependsOn must be in the same group.
Do not call AddClusterResourceDependency if hResource is already online. The call fails with an ERROR_RESOURCE_ONLINE error. Note that this behavior has changed with Windows Server 2008. You can call AddClusterResourceDependency and modify resource dependencies without requiring the resource to be brought offline.
Do not call AddClusterResourceDependency from a resource DLL. For more information, see Function Calls to Avoid in Resource DLLs.
Do not pass LPC and RPC handles to the same function call. Otherwise, the call will raise an RPC exception and can have additional destructive effects. For information on how LPC and RPC handles are created, see Using Object Handles and OpenCluster.
Requirements
Requirement | Value |
---|---|
Minimum supported client | None supported |
Minimum supported server | Windows Server 2008 Enterprise, Windows Server 2008 Datacenter |
Target Platform | Windows |
Header | clusapi.h |
Library | ClusAPI.lib |
DLL | ClusAPI.dll |