3.1.4.1.20 ApiAddResourceDependency (Opnum 19)

(Protocol Version 2) The ApiAddResourceDependency method instructs the server to add a simple dependency, as specified in section 3.1.1.1.2, from the resource that is identified by the hResource parameter to the resource that is identified by the hDependsOn parameter. For successful completion of the method, the server MUST add the dependency to the nonvolatile cluster state.

The server MUST fail this method with ERROR_DEPENDENCY_ALREADY_EXISTS (0x0000138B) if a dependency already exists between the resource that is identified by hResource and the resource that is identified by hDependsOn. The server MUST fail this method with ERROR_CIRCULAR_DEPENDENCY (0x00000423)  if the new dependency would result in a circular dependency between the two resources. The server MUST fail this method with ERROR_INVALID_PARAMETER (0x00000057) if hResource and hDependsOn designate the same resource.

Any limits imposed by the server on the depth of a resource's dependency tree are implementation-specific.

The server MUST accept an ApiAddResourceDependency request only if its protocol server state is read/write, as specified in section 3.1.1.

 error_status_t ApiAddResourceDependency(
   [in] HRES_RPC hResource,
   [in] HRES_RPC hDependsOn
 );

hResource: An HRES_RPC context handle that was obtained in a previous ApiOpenResource or ApiCreateResource method call.

hDependsOn: An HRES_RPC context handle that was obtained in a previous ApiOpenResource method call. After successful completion of this method, the resource that is specified in the hResource parameter has a simple dependency to this resource.

Return Values: The method MUST return the following error codes for the specified conditions.

Return value/code

Description

0x00000000

ERROR_SUCCESS

Success.

0x00000006

ERROR_INVALID_HANDLE

The data that is pointed to by either the hResource parameter or the hDependsOn parameter does not represent a valid HRES_RPC context handle.

0x0000138B

ERROR_DEPENDENCY_ALREADY_EXISTS

A dependency already exists from the resource that is identified by hResource to the resource that is identified by hDependsOn.

0x13CD

ERROR_DEPENDENCY_NOT_ALLOWED

The dependent resource is the quorum.

0x00000423

ERROR_CIRCULAR_DEPENDENCY

The new dependency would result in a circular dependency between the two resources.

0x00000057

ERROR_INVALID_PARAMETER

The hResource parameter and the hDependsOn parameter designate the same resource.

0x0000139B

ERROR_RESOURCE_ONLINE

This error code MUST be returned if the following condition is true:

  • The resource that is identified by hResource is not in the ClusterResourceFailed, ClusterResourceOffline, or ClusterResourceInitializing state.

0x0000138E

ERROR_RESOURCE_NOT_AVAILABLE

The resource represented by either the hResource parameter or the hDependsOn parameter no longer exists in the nonvolatile cluster state.

For any other condition, this method MUST return a value that is not one of the values listed in the preceding table. The client MUST behave in one consistent, identical manner for all values that are not listed in the preceding table. The client SHOULD treat errors specified in section 3.2.4.6 as recoverable errors and initiate the reconnect procedure as specified in section 3.2.4.6.