Skip Navigation Links
Exit Print View
| Oracle Solaris Cluster Data Services Developer's Guide Oracle Solaris Cluster 4.1

Search Scope:

- This Document
- Entire Library

## `Stop` Method

The `Stop` callback method of a resource type implementation is called by the RGM on a cluster node to stop the application.

The callback semantics for the `Stop` method demand the following factors:

- The `Stop` method must be idempotent because the `Stop` method can be called by the RGM even if the `Start` method did not complete successfully on the node. Thus, the `Stop` method must succeed (exit zero) even if the application is not currently running on the cluster node and there is no work for it to do.

- If the `Stop` method of the resource type fails (exits nonzero) on a cluster node, the resource that is being stopped enters the `STOP_FAILED` state. Depending on the `Failover_mode` setting on the resource, this condition might lead the RGM to perform a hard reboot of the cluster node.

  Thus, you must design the `Stop` method so that this method definitely stops the application. You might even need to resort to using `SIGKILL` to kill the application abruptly if the application otherwise fails to terminate.

  You must also ensure that this method stops the application in a timely fashion because the framework treats expiry of the `Stop_timeout` property as a stop failure, and consequently puts the resource in a `STOP_FAILED` state.

The DSDL utility `scds_pmf_stop()` should suffice for most applications as it first attempts to softly stop the application with `SIGTERM`. This function then delivers a `SIGKILL` to the process. This function assumes that the application was started under the PMF with `scds_pmf_start()`. See PMF Functions for details about this utility.

Assuming that the application-specific function that stops the application is called `svc_stop()`, implement the `Stop` method as follows:

    if (scds_initialize(&handle, argc, argv)!= SCHA_ERR_NOERR)
    {
       return (1);   /* Initialization Error */
    }
    return (svc_stop(handle));

Whether or not the implementation of the preceding `svc_stop()` function includes the `scds_pmf_stop()` function is irrelevant. Your decision to include the `scds_pmf_stop()` function depends on whether or not the application was started under the PMF through the `Start` method.

The `svc_validate()` method is not used in the implementation of the `Stop` method because, even if the system is currently experiencing a problem, the `Stop` method should attempt to stop the application on this node.

Copyright © 2000, 2012, Oracle and/or its affiliates. All rights reserved. Legal Notices |