3.1.4.2.13 ApiGetResourceState (Opnum 12)

(Protocol Version 3) The ApiGetResourceState method returns the current state of the specified resource, the name of the node that currently owns the resource, and the name of the group that contains the resource.

The server SHOULD accept an ApiGetResourceState request if its protocol server state is read-only and MUST accept the request for processing if it is in the read/write state, as specified in section 3.1.1.

The server SHOULD change the state of a resource according to implementation-specific mechanisms and protocols between servers, such as when the cluster detects that a resource that was online has failed.

The resource state sequence number MUST be monotonically incremented when a transition between the resource states occurs.

The current state of a resource MUST be one of the possible values specified for the State parameter later in this section.

The server SHOULD accept an ApiGetResourceState request if the access level associated with the hResource context handle is at least "Read" (section 3.1.4).

 error_status_t ApiGetResourceState(
   [in] HRES_RPC hResource,
   [out] DWORD *State,
   [out, string] LPWSTR *NodeName,
   [out, string] LPWSTR *GroupName,
   [out] error_status_t *rpc_status
 );

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

State: The current state of the resource, which is written by the server to indicate the success of this method. If the method fails, this parameter MUST be ignored. If the method succeeds, State MUST be set to one of the following values.

Value

Meaning

ClusterResourceInitializing

0x00000001

The resource is performing initialization.

ClusterResourceOnline

0x00000002

The resource is active or available and functioning normally.

ClusterResourceOffline

0x00000003

The resource is not active or available.

ClusterResourceFailed

0x00000004

The resource failed to reach the online state.

ClusterResourceOnlinePending

0x00000081

The resource is in the process of transitioning to the ClusterResourceOnline state.

ClusterResourceOfflinePending

0x00000082

The resource is in the process of transitioning to the ClusterResourceOffline state.

ClusterResourceStateUnknown

0xFFFFFFFF

The operation to retrieve resource state was not successful.

NodeName: The address of a pointer where the server MUST write, upon successful completion of this method, the address of a Unicode string buffer containing the name of the node that currently owns this resource. The server MUST allocate as much memory as is required to return the node name. If the method fails, this parameter MUST be ignored.

GroupName: The address of a pointer where the server MUST write, upon successful completion of this method, the address of a Unicode string buffer containing the name of the group that contains this resource. The server MUST allocate as much memory as is required to return the group name. If the method fails, this parameter MUST be ignored.

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 hResource parameter does not represent a valid HRES_RPC context handle.

0x0000138E

ERROR_RESOURCE_NOT_AVAILABLE

The cluster resource is not available.

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.