Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
8.  Sample DSDL Resource Type Implementation xfnts_start Method Returning From svc_start()  Previous   Contents   Next 
   
 

Note - Before it exits, the xfnts_start method calls scds_close() to reclaim resources allocated by scds_initialize(). See scds_initialize() Function and the scds_close(3HA) man page for details.


xfnts_stop Method

Because the xfnts_start method uses scds_pmf_start() to start the service under PMF, xfnts_stop uses scds_pmf_stop() to stop the service.


Note - The first call in xfnts_stop is to scds_initialize(), which performs some necessary house-keeping functions (the scds_initialize() Function and the scds_initialize(3HA) man page contain more detail.


The xfnts_stop method calls the svc_stop() method, which is defined in xfnts.c as follows.

scds_syslog(LOG_ERR, "Issuing a stop request.");
   err = scds_pmf_stop(scds_handle,
       SCDS_PMF_TYPE_SVC, SCDS_PMF_SINGLE_INSTANCE, SIGTERM,
       scds_get_rs_stop_timeout(scds_handle));

   if (err != SCHA_ERR_NOERR) {
      scds_syslog(LOG_ERR,
          "Failed to stop HA-XFS.");
      return (1);
   }

   scds_syslog(LOG_INFO,
       "Successfully stopped HA-XFS.");
   return (SCHA_ERR_NOERR); /* Successfully stopped */

Note the following about the call in svc_stop() to the scds_pmf_stop() function.

  • SCDS_PMF_TYPE_SVC parameter identifies the program to stop as a data service application--this method can also stop a fault monitor or some other type of application.

  • The SCDS_PMF_SINGLE_INSTANCE parameter identifies the signal.

  • The SIGTERM parameter identifies the signal to use to stop the resource instance. If this signal fails to stop the instance, scds_pmf_stop() sends SIGKILL to stop the instance, and if that fails, returns with a timeout error. See the scds_pmf_stop(3HA) man page for details.

  • The timeout value is that of the Stop_timeout property of the resource.


Note - Before it exits, the xfnts_stop method calls scds_close() to reclaim resources allocated by scds_initialize(). See scds_initialize() Function and the scds_close(3HA) man page for details.


xfnts_monitor_start Method

The RGM calls the Monitor_start method on a node to start the fault monitor after a resource is started on the node. The xfnts_monitor_start method uses scds_pmf_start() to start the monitor daemon under PMF.


Note - The first call in xfnts_monitor_start is to scds_initialize(), which performs some necessary house-keeping functions (the scds_initialize() Function and the scds_initialize(3HA) man page contain more detail.


The xfnts_monitor_start method calls the mon_start method, which is defined in xfnts.c as follows.

scds_syslog_debug(DBG_LEVEL_HIGH,
      "Calling Monitor_start method for resource <%s>.",
      scds_get_resource_name(scds_handle));

    /* Call scds_pmf_start and pass the name of the probe. */
   err = scds_pmf_start(scds_handle, SCDS_PMF_TYPE_MON,
       SCDS_PMF_SINGLE_INSTANCE, "xfnts_probe", 0);

   if (err != SCHA_ERR_NOERR) {
      scds_syslog(LOG_ERR,
          "Failed to start fault monitor.");
      return (1);
   }

   scds_syslog(LOG_INFO,
       "Started the fault monitor.");

   return (SCHA_ERR_NOERR); /* Successfully started Monitor */
}

Note the following about the call in svc_mon_start() to the scds_pmf_start() function.

  • SCDS_PMF_TYPE_MON parameter identifies the program to start as a fault monitor--this method can also start a data service or some other type of application.

  • The SCDS_PMF_SINGLE_INSTANCE parameter identifies this as a single-instance resource.

  • The xfnts_probe parameter identifies the monitor daemon to start. The assumption is that the monitor daemon is in the same directory as the other callback programs.

  • The final parameter, 0, specifies the child monitoring level--in this case, monitor the monitor daemon only.


Note - Before it exits, the xfnts_monitor_start method calls scds_close() to reclaim resources allocated by scds_initialize(). See scds_initialize() Function and the scds_close(3HA) man page for details.


xfnts_monitor_stop Method

Because the xfnts_monitor_start method uses scds_pmf_start() to start the monitor daemon under PMF, xfnts_monitor_stop uses scds_pmf_stop()to stop the monitor daemon.


Note - The first call in xfnts_monitor_stop is to scds_initialize(), which performs some necessary house-keeping functions (the scds_initialize() Function and the scds_initialize(3HA) man page contain more detail.


The xfnts_monitor_stop() method calls the mon_stop method, which is defined in xfnts.c as follows.

scds_syslog_debug(DBG_LEVEL_HIGH,
      "Calling scds_pmf_stop method");

   err = scds_pmf_stop(scds_handle, SCDS_PMF_TYPE_MON,
       SCDS_PMF_SINGLE_INSTANCE, SIGKILL,
       scds_get_rs_monitor_stop_timeout(scds_handle));

   if (err != SCHA_ERR_NOERR) {
      scds_syslog(LOG_ERR,
          "Failed to stop fault monitor.");
      return (1);
   }

   scds_syslog(LOG_INFO,
       "Stopped the fault monitor.");

   return (SCHA_ERR_NOERR); /* Successfully stopped monitor */
}

Note the following about the call in svc_mon_stop() to the scds_pmf_stop() function.

  • SCDS_PMF_TYPE_MON parameter identifies the program to stop as a fault monitor--this method can also stop a data service or some other type of application.

  • The SCDS_PMF_SINGLE_INSTANCE parameter identifies this as a single-instance resource.

  • The SIGKILL parameter identifies the signal to use to stop the resource instance. If this signal fails to stop the instance, scds_pmf_stop() returns with a timeout error. See the scds_pmf_stop(3HA)) man page for details.

  • The timeout value is that of the Monitor_stop_timeout property of the resource.


Note - Before it exits, the xfnts_monitor_stop method calls scds_close() to reclaim resources allocated by scds_initialize(). See scds_initialize() Function and the scds_close(3HA) man page for details.


 
 
 
  Previous   Contents   Next