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
ERROR_CIRCULAR_DEPENDENCY
1059 (0x423)
A resource depends on itself.
ERROR_DEPENDENCY_ALREADY_EXISTS
5003 (0x138B)
The resource dependency already exists.
ERROR_DEPENDENCY_NOT_ALLOWED
5069 (0x13CD)
The dependent resource is the quorum.
ERROR_INVALID_PARAMETER
87 (0x57)
The resources are not in the same group.
ERROR_RESOURCE_NOT_AVAILABLE
5006 (0x138E)
At least one of the resources is marked for deletion.
ERROR_RESOURCE_ONLINE
5019 (0x139B)
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

See also

CanResourceBeDependent

OpenCluster

OpenClusterResource

RemoveClusterResourceDependency