Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
8.  Sample DSDL Resource Type Implementation SUNW.xfnts Fault Monitor svc_probe() Function  Previous   Contents   Next 
   
 

When finished, svc_probe() returns a success (0), partial failure (50), or complete failure (100) value. The xfnts_probe method passes this value to scds_fm_action().

Determining the Fault Monitor Action

The xfnts_probe method calls scds_fm_action() to determine the action to take. The logic in scds_fm_action() is as follows:

  • Maintain a cumulative failure history within the value of the Retry_interval property.

  • If the cumulative failure reaches 100 (complete failure) restart the data service. If Retry_interval is exceeded, reset the history.

  • If the number of restarts exceeds the value of the Retry_count property, within the time specified by Retry_interval, failover the data service.

For example, suppose the probe makes a connection to the xfs server, but fails to disconnect. This indicates that the server is running, but could be hung or just under a temporary load. The failure to disconnect sends a partial (50) failure to scds_fm_action(). This value is below the threshold for restarting the data service, but the value is maintained in the failure history.

If during the next probe the server again fails to disconnect, a value of 50 is added to the failure history maintained by scds_fm_action(). The cumulative failure value is now 100, so scds_fm_action() restarts the data service.

xfnts_validate Method

The RGM calls the Validate method when a resource is created and when administrative action updates the properties of the resource or its containing group. The RGM calls Validate before the creation or update is applied, and a failure exit code from the method on any node causes the creation or update to be canceled.

The RGM calls Validate only when resource or group properties are changed through administrative action, not when the RGM sets properties, or when a monitor sets the resource properties Status and Status_msg.


Note - The Monitor_check method also explicitly calls the Validate method whenever the PROBE method attempts to fail the data service over to a new node.


The RGM calls Validate with additional arguments to those passed to other methods, including the properties and values being updated. The call to scds_initialize() at the beginning of xfnts_validate parses all the arguments the RGM passes to xfnts_validate and stores the information in the scds_handle parameter. The subroutines that xfnts_validate calls make use of this information.

The xfnts_validate method calls svc_validate(), which verifies the following.

  • The Confdir_list property has been set for the resource and defines a single directory.

    scha_str_array_t *confdirs;
       confdirs = scds_get_ext_confdir_list(scds_handle);
       
    /* Return error if there is no confdir_list extension property */
       if (confdirs == NULL || confdirs->array_cnt != 1) {
          scds_syslog(LOG_ERR,
              "Property Confdir_list is not set properly.");
          return (1); /* Validation failure */
       }
  • The directory specified by Confdir_list contains the fontserver.cfg file.

    (void) sprintf(xfnts_conf, "%s/fontserver.cfg", confdirs->str_array[0]);
      
       if (stat(xfnts_conf, &statbuf) != 0) {
          /*
           * suppress lint error because errno.h prototype
           * is missing void arg
           */
          scds_syslog(LOG_ERR,
              "Failed to access file <%s> : <%s>",
              xfnts_conf, strerror(errno));   /*lint !e746 */
          return (1);
       }
  • The server daemon binary is accessible on the cluster node.

    if (stat("/usr/openwin/bin/xfs", &statbuf) != 0) {
          scds_syslog(LOG_ERR,
              "Cannot access XFS binary : <%s> ", strerror(errno));
          return (1);
       }
  • The Port_list property specifies a single port.

    scds_port_list_t   *portlist;
       err = scds_get_port_list(scds_handle, &portlist);
       if (err != SCHA_ERR_NOERR) {
          scds_syslog(LOG_ERR,
              "Could not access property Port_list: %s.",
             scds_error_string(err));
          return (1); /* Validation Failure */
       }
    
    #ifdef TEST
       if (portlist->num_ports != 1) {
          scds_syslog(LOG_ERR,
              "Property Port_list must have only one value.");
          scds_free_port_list(portlist);
          return (1); /* Validation Failure */
       }
    #endif
  • The resource group containing the data service also contains at least one network-address resource.

    scds_net_resource_list_t *snrlp;
       if ((err = scds_get_rs_hostnames(scds_handle, &snrlp))
          != SCHA_ERR_NOERR) {
          scds_syslog(LOG_ERR,
              "No network address resource in resource group: %s.",
             scds_error_string(err));
          return (1); /* Validation Failure */
       }
    
       /* Return an error if there are no network address resources */
       if (snrlp == NULL || snrlp->num_netresources == 0) {
          scds_syslog(LOG_ERR,
              "No network address resource in resource group.");
          rc = 1;
          goto finished;
       }

Before it returns, svc_validate() frees all allocated resources.

finished:
   scds_free_net_list(snrlp);
   scds_free_port_list(portlist);

   return (rc); /* return result of validation */

Note - Before it exits, the xfnts_validate 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