3.1.4.2.20 ApiAddResourceDependency (Opnum 19)

(Protocol Version 3) 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.

The server MUST limit the depth of a resource's dependency tree to 100.

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

The server MUST require that the access level associated with the hResource context handle is "All" and that the access level associated with the hDependsOn context handle is "All" (section 3.1.4).

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

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

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

rpc_status: A 32-bit integer used to indicate success or failure. The RPC runtime MUST indicate, by writing to this parameter, whether it succeeded in executing this method on the server. The encoding of the value passed in this parameter MUST conform to encoding for comm_status and fault_status, as specified in Appendix E of [C706].

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 any of the following conditions are true:

  • The resource designated by hResource is in the ClusterResourceOnlinePending state.

  • The resource designated by hResource is in the ClusterResourceOnline state and the resource designated by hDependsOn is not in the ClusterResourceOnline 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.