OpenSolaris

You are not signed in. Sign in or register.

Code Overview for SUNW.gds Based Agents

All agents that are based on the usage of the Generic Data Service (GDS), and thus have the resource type SUNW.gds, can be found at:

<OHACDS-source-root>/usr/src/cmd/ha-services/gds-agents/

Each agent has its own directory. The directory name is derived from the agent's official package name where the SUNWsc part is being omitted. For example, the agent for Samba uses the package name SUNWscsmb and is located at <OHACDS-source-root>/usr/src/cmd/ha-services/gds-agents/smb/.

The configuration for the agent packages is organized within <OHACDS-source-root>/usr/src/pkgdefs/SUNWsc<agent>/ and contains the information to build the depend, pkginfo, and prototype file for the specific package.

If the agent consists of several components, then the files specific to the component are placed within their own subdirectory. The main directory is for commonly used files shared between the components.

Most agents are written 100% as ksh shell scripts (indicated with the .ksh suffix). The Makefile then mainly makes sure that the corresponding package directory structure is created and the shell scripts and configuration files are placed into the correct directories.

Currently, the DHCP agent also comes with C source files (indicated with the .c suffix). The Makefile then also contains the rules to build (lint, compile, and link) the corresponding binaries.

Variations in Directory Structures

  • The common directory structure for the installed package for agents without several components looks like:

    <rootpath>/opt/SUNWsc<agent>/
    bin/ Containing the scripts that are executed by SUNW.gds and registered as Start_command, Stop_command and Probe_command. Some agents also provide a Validation_command. These scripts are used during runtime of the agent.
    etc/ Containing the configuration file config, which is used to enable/disable debugging code, the RTR file and any agent specific parameter file, if used. The configuration and parameter files are evaluated during agent runtime.
    util/ Containing the agent configuration file and a register script. The configuration file must be ammended by the user. The register script performs all necessary steps to register the SUNW.gds resource. These scripts are only used at agent registration time; they are not used during runtime of the agent.

    Examples of agents without several components are the 9ias, PostgreSQL, dhc, mys, saa, sag, and tomcat agents.

  • The directory structure for agents that have several components has the following charactistics:

    • The agents have the bin/, etc/ and util/ directories in their component subdirectory, as described in the previous table.

    • Some of the agents might also have a lib/ directory in the agents top directory, containing common ksh shell script functions used by all components.

    • Some of the agents might also have just one util/ directory in the agents top directory, if components are always registered and used together.

    Examples of agents with several components are the ebs, pax, sge, smb, sps, and zone agents.

Scripts for the HA-Container Agent

Some agents are designed to register and run on top of the HA-Container agent (short name: zone). These agents have additional scripts within their util/ directory that deal with the registration of the sczsmf component and the corresponding SMF service within the non-global zone. These scripts are called by the agents register script.

These agents also contain a control script contained in the bin/ directory, which implements the logic to run either as a "real" SUNW.gds resource or as a SMF method script when used by the sczsmf component of the HA-Container agent.

Examples are the PostgreSQL, mys, smb, mqs, sps, and tomcat agents.

Example

The following briefly describes the individual files of the Samba agent, as an example. The agent has two components and is HA-Container agent aware.

The location for the Samba agent is <OHACDS-source-root>/usr/src/cmd/ha-services/gds-agents/smb/

Makefile This file defines the SUBDIRS for the components and the rules to relate the scripts and configuration files with the corresponding installation location.
control_samba.ksh This control script implements the logic to fulfill two roles:
  1. Pure GDS runtime code when called with "-" options, then assuming to be able to make Sun Cluster API calls.
  2. Usage as SMF method script when called out of the FMRI context without any "-" options. Instead, SMF properties are used.
This control script calls the corresponding shell functions from the functions.ksh file for the case of "start", "stop", and "probe".
functions.ksh A library of shell functions implementing all the necessary methods to handle the Samba application within the Sun Cluster framework. It is sourced by all shell scripts using those functions.
samba_config.ksh The configuration file that a user needs to amend to reflect the intended configuration of the Samba resource. It is used by samba_register.ksh.
samba_register.ksh This script registers the samba and/or winbind resource based on the configuration setup within samba_config.ksh.
samba_smf_register.ksh This script registers the SMF manifest for samba and/or winbind in the non-global zone, if the agent is used in combination with the HA-Container agent. This script is called by samba_register.ksh if the setup in samba_config.ksh indicates the failover zone usage.
samba_smf_remove.ksh This script helps to remove the registered SMF manifest for samba and/or winbind, if the corresponding resource should get removed again.
SUNW.smb This is a "dummy" RTR file (dummy, since the real resource type is SUNW.gds for this resource), which is used by the scinstall cluster command in case of an upgrade to newer cluster software and thus new agent version.
samba/Makefile Defines rules to relate the scripts and configuration files with the corresponding installation location for the samba component.
samba/config File that allows you to enable/disable debug code and messages while the samba component is running.
samba/probe_samba.ksh Script which is a wrapper for control_samba.ksh to get registered with the Probe_command property of SUNW.gds for the samba component.
samba/start_samba.ksh Script which is a wrapper for control_samba.ksh to get registered with the Start_command property of SUNW.gds for the samba component.
samba/stop_samba.ksh Script which is a wrapper for control_samba.ksh to get registered with the Stop_command property of SUNW.gds for the samba component.
winbind/Makefile Defines rules to relate the scripts and config files with the corresponding installation location for the winbind component.
winbind/config File that allows to enable/disable debug code and messages while the winbind component is running.
winbind/probe_winbind.ksh Script which is a wrapper for control_samba.ksh to get registered with the Probe_command property of SUNW.gds for the winbind component.
winbind/start_winbind.ksh Script which is a wrapper for control_samba.ksh to get registered with the Start_command property of SUNW.gds for the winbind component.
winbind/stop_winbind.ksh Script which is a wrapper for control_samba.ksh to get registered with the Stop_command property of SUNW.gds for the winbind component.