3.7 Customizing the Translation Syntax for Converting Load and Unload Scripts

The syntax for load and unload scripts differs for NetWare and Linux platforms. A script that is valid for the NetWare platform is not necessarily recognized on the OES platform. In a mixed-platform cluster, a cluster resource’s load script and unload script must be translated to use the proper syntax when running on the NetWare or Linux nodes. Translation occurs in-memory while the cluster contains mixed-platform nodes, and during the final cluster conversion of the cluster from NetWare to Linux.

The translation between NetWare and Linux versions of the load and unload scripts is performed by the Cluster Translation Library script (/opt/novell/ncs/bin/clstrlib.py). The normal translations in the library are described in Section 3.1, Translation of Cluster Resource Scripts for Mixed NetWare and Linux Clusters. If the commands in a cluster resource’s load or unload scripts are not part of the translation library, the cluster resource can end up in a comatose state.

Novell Cluster Services allows you to customize the translation syntax that is used for load and unload scripts in mixed-platform situations by defining new syntax translations in the /var/opt/novell/ncs/customized_translation_syntax file that you create. The clstrlib.py script reads the additional translation syntax from the syntax file, and processes them in addition to the normal translations in the Cluster Translation Library.

The customized translation supports using Python regular expressions to search for strings ((\S+)), digits ((\d+)), and other data types. The search is case insensitive.

NOTE:Refer to information about Python regular expressions to learn how to create searches for other data types.

In a text editor, create the customized_translation_syntax file with the additional translation syntax that you need, then copy the file to the /var/opt/novell/ncs/ directory on each Linux node in the mixed-platform cluster.

The syntax file should contain a four-line command for each type of translation you want to add:

<R|D> search_string
[replacement_data]
[preceding_data]

You can have any number of the four-line commands in the file. Use the following guidelines for creating the syntax translation commands:

Line

Description

<R|D>

Specify whether to replace (R) all matches or to delete (D) all matches of the data type you are looking for in the load or unload script.

search_string

Specify the search string that is used to locate a line in the scripts.

[replacement_data]

Specify the replacement data used to replace a line matched by the search performed.

Leave this line empty if there is no replacement.

[preceding_data]

Specify a line to be inserted before the first line that is matched by the search performed.

Leave this line empty if there is no line to be inserted before the first matching line.

The following four lines are sample code for a search command in the customized_translation_syntax file. The fourth line is intentionally left empty.

R
^\s*bind\s+IP\s+(\S+)\s(\S+)\s+address=(\d+\.\d+\.\d+\.\d+)
ignore_error bind IP \1 \2 address=\3\n
exit_on_error ip addr add \3/32 dev \1

You can use the cluster convert preview command to verify that the customized_translation_syntax file is working as intended for a particular resource.

  1. On the master node, open a terminal console as the root user, then enter

    cluster convert preview resource_name