Oracle® Solaris Cluster Data Services Developer's Guide

Exit Print View

Updated: July 2014, E39646-01
 
 

Starting the Service With svc_start()

The xfnts_start method calls the svc_start() method, which is defined in the xfnts.c file, to start the xfs daemon. This section describes svc_start().

The command to start the xfs daemon is as follows:

# xfs -config config-directory/fontserver.cfg -port port-number

The Confdir_list extension property identifies the config-directory while the Port_list system property identifies the port-number. The cluster administrator provides specific values for these properties when he or she configures the data service.

The xfnts_start method declares these properties as string arrays. The xfnts_start method obtains the values that the cluster administrator sets by using the scds_get_ext_confdir_list() and scds_get_port_list() functions. These functions are described in the scds_property_functions(3HA) man page.

scha_str_array_t *confdirs;
scds_port_list_t    *portlist;
scha_err_t   err;

/* get the configuration directory from the confdir_list property */
confdirs = scds_get_ext_confdir_list(scds_handle);

(void) sprintf(xfnts_conf, "%s/fontserver.cfg", confdirs->str_array[0]);

/* obtain the port to be used by XFS from the Port_list property */
err = scds_get_port_list(scds_handle, &portlist);
if (err != SCHA_ERR_NOERR) {
scds_syslog(LOG_ERR,
"Could not access property Port_list.");
return (1);
}

Note that the confdirs variable points to the first element (0) of the array.

The xfnts_start method uses sprintf() to form the command line for xfs.

/* Construct the command to start the xfs daemon. */
(void) sprintf(cmd,
"/usr/bin/xfs -config %s -port %d 2>/dev/null",
xfnts_conf, portlist->ports[0].port);

Note that the output is redirected to /dev/null to suppress messages that are generated by the daemon.

The xfnts_start method passes the xfs command line to scds_pmf_start() to start the data service under the control of the PMF.

scds_syslog(LOG_INFO, "Issuing a start request.");
err = scds_pmf_start(scds_handle, SCDS_PMF_TYPE_SVC,
SCDS_PMF_SINGLE_INSTANCE, cmd, -1);

if (err == SCHA_ERR_NOERR) {
scds_syslog(LOG_INFO,
"Start command completed successfully.");
} else {
scds_syslog(LOG_ERR,
"Failed to start HA-XFS ");
}

    Note the following points about the call to scds_pmf_start():

  • The SCDS_PMF_TYPE_SVC argument identifies the program to start as a data service application. This method can also start a fault monitor or some other type of application.

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

  • The cmd argument is the command line that was generated previously.

  • The final argument, -1, specifies the child monitoring level. The -1 value specifies that the PMF monitor all children as well as the original process.

Before returning, svc_pmf_start() frees the memory that is allocated for the portlist structure.

scds_free_port_list(portlist);
return (err);