Implementing Online
A resource is not available until it is online. The Cluster service calls your Online entry point to request that a resource instance be brought from an offline (unavailable) state to an online (available) state. Your implementation of Online is thus the first opportunity you have to ensure high availability.
Typically, the tasks required to bring a resource online take a long time to complete (hundreds to thousands of milliseconds). Most Online implementations create a worker thread to perform these tasks asynchronously.
Whether you implement Online synchronously or asynchronously, your online code should perform the following tasks:
To bring a resource online
Recommended: Retrieve the current values of the resource's private properties by calling ResUtilGetPropertiesToParameterBlock.
Required: If the resource is a service
Call ResUtilStopResourceService (if necessary) to stop the service before changing the service options.
Call ResUtilSetResourceServiceStartParameters to make the service controllable by the cluster.
Required: Bring the resource to an operational state. For applications, this might be as simple as calling CreateProcess.
To implement Online
Required: The Online entry point function can be called concurrently with the Terminate entry point function. Any resources that are accessed by both entry points must be properly guarded.
Recommended: For optimal performance, return a value within 300 milliseconds. If you need more time to perform all of the necessary tasks, have Online start a worker thread and return ERROR_IO_PENDING immediately. See Implementing Pending Operations.
Optional: If you want to implement asynchronous failure detection, return a handle to an object that can be signaled—such as a semaphore—as the EventHandle parameter. For more information see Detecting Resource Failure.
Example