HP XC System Software Administration Guide Version 3.1

The gconfigure scripts return 0 (zero) on success and return a nonzero value on failures. You can stop
the configuration process on a nonrecoverable gconfigure error, which is indicated by the gconfigure
script exiting with a return code of 255. Alternatively, you can use (config_die) in ConfigUtils.pm
to return 255. Any exit code other than 255 will continue with the configuration process.
A gconfigure script can have a user interface to aid in configuration and can suggest more optimal
configuration choices.
A gconfigure script is executed inside the cluster_config utility as follows:
script_path gconfigure server1 server2 server3 ...
script_path gunconfigure server1 server2 server3 ...
script_path gunconfigure
Combining the gunconfigure server with a server list unconfigures the specified nodes as servers for
the service, but the service will still be active in the system (on other nodes). Server lists are derived from
the servers specified during role assignment within the cluster_config utility. A gunconfigure
script with no server list means that the service is being entirely unconfigured and will not be part of the
new configuration being performed. The gunconfigure scripts are run only if some current server or
servers are being removed from service.
In general, a gconfigure script assigns clients across all servers passed to it if possible. There are
exceptions, such as services that must run on the head node only. Nothing precludes each gconfigure
script from suggesting a more optimal allocation within its user interface. Such behavior is not expected
to be typical, however.
Most services can build service-specific client lists within their gconfigure scripts completely by using
a provided API. Client information that comes from the database to enable this consists of the following:
Nodes identified in the database by the setting of node attributes (including the predefined attributes,
such as na_all)
Service-specific client selection flags (such as sa_no_client_on_server)
You can use node attributes (such as na_all) to include or exclude nodes, and you can use service attributes
(such as sa_no_client_on_server) to refine the list with particular patterns. There is a small set of
convenience function APIs to return per-service client lists. These sources of information (database, node
attributes, service attributes) are sufficient in almost all cases to build client lists.
Writing gconfigure Scripts
The information in this section provides information about how to write a gconfigure script. A sample
gconfigure script is provided in the /opt/hptc/templates/gconfig.d/gconfig_template.pl
file for your reference.
The gconfigure and other configuration scripts often use the Perl Set::Node package, which is
derived from the Set::Scalar package (from Perl's CPAN) to facilitate working with sets of nodes with
the usual set operators (union, intersection, difference, and so on). In object-oriented terms, Set::Node
is a Set::Scalar.
For more information about the Set::Scalar package from which Set::Node inherits, enter the
following command to view the manpage:
# man Set::Scalar
The main difference between the Set::Scalar and Set::Node packages is that node_set->members()
returns nodes in numerically sorted order, and scalar_set->members() returns members in random
order. When order does not matter but efficiency does matter, use node_set->unsorted_members().
Set::Node also adds the select_by_name and select_by_attribute member functions.
Example 4-1 shows a sample gconfig script that performs client selection and client-to-server assignments.
64 Managing and Customizing System Services