Add application instance functionality
There are two pieces to constructing a Smart Assist that allow users to add new instances of an application to the PowerHA® SystemMirror® configuration, the SMIT component, which include the dialog and smit fields, and the script that performs the add operation.
Both of these operate on a single Smart Assist component and are described in the sections that follow.
Creating the add SMIT screen
The add SMIT screens identifiers for the GASA Smart Assist are defined in the call to claddsa:
SMIT_ADD="clsa_gasa_add" and
SMIT_ADD_TYPE="d" These entries point to a SMIT sm_cmd_hdr element, whose children are sm_cmd_opt entries that form the SMIT dialog fields. These fields are where the user enters information related to the application, such as the name, service IP label to use, and the start and stop scripts that are required by the Smart Assistant. The entries used to construct the dialog are shown in the section SMIT general application Smart Assist add stanzas.
The application framework will call the following SMIT command header entry "clsa_gasa_add", which provides the General Application Smart Assist SMIT screen:
General Application Smart Assist
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
[Entry Fields]
* Application Name []
* Primary Node [node name displays here] +
* Takeover Nodes [node names display here] +
* Application Controller Start Script []
* Application Controller Stop Script []
* Service IP Label [] +
Not all Smart Assists transition to a sm_cmd_hdr; in some cases a sm_name_hdr is required to provide a select list prior to entering the dialog. In those cases the SMIT_ADD_TYPE would equal 'n' for name selector, and the SMIT_ADD field for the component would point to the SMIT id of the sm_name_hdr.
Creating the add script
Each of the field entries that are provided above correspond to an argument that will be passed to the add script: GASA Smart Assist add script: /usr/es/sbin/cluster/sa/gasa/add
| Field Name | Argument | Discovery Field Name (disc_name) |
|---|---|---|
| Application Name | -a name | N/A |
| Primary Node | -P node | Primary |
| Takeover Nodes | -T nodes | takeover |
| Start Script | -R script | N/A |
| Stop Script | -O script | N/A |
| Service IP label | -S ip_label | N/A |
| -C component_id | N/A | |
| -s smartassist_id | N/A |
GASA Add Screen Field Names to Arguments
The GASA add script can be re-used in your Smart Assist. Note that the caller provides the Smart Assist identifier and the component identifier. By changing the Smart Assist identifier -s, and the component identifier -C, you can use the existing GASA add script as the basis for your Smart Assist components add script. The add script performs the following sequence of operations:
- Checks the user-entered application name for a duplicate entry using the claddsaapp API command.
- Determines if the Application Controller already exists using:
clvt query application - Determines if the resource group already exists using:
clvt query resource_group - Calls clsapre
- Adds the application controller to the PowerHA SystemMirror configuration.
clvt add application $SERVERNAME \ STARTSCRIPT=$STARTSCRIPT \ STOPSCRIPT=$STOPSCRIPT - Adds the resource group to the PowerHA SystemMirror configuration.
clvt add resource_group "$RG_NAME" \ PRIMARYNODES="$PRIMARY $TAKEOVER" \ STARTUP="OHN" \ FALLBACK="NFB" \ FALLOVER="FNPN" - Creates the service IP label if it is not already defined.
clvt add service_ip $SERVICE_LABEL - Associates the service IP label and any available (shared) volume
groups amongst the participating nodes (primary and takeover).
clvt modify resource_group "$RG_NAME" \ APPLICATIONS="$NAME" \ SERVICE_LABEL="$IP" \ VOLUME_GROUP="$VGS" \ VG_AUTO_IMPORT="true" \ FORCED_VARYON="false" \ FILESYSTEM="" - Registers the application name resource group with the Smart Assist
identifier and component identifier. This ensures that when the user
goes to select the particular application instance to modify, the
framework knows what type of application it is associated with.
claddsaapp -a $APPLICATION_NAME \ APPLICATION_NAME="$APPLICATION_NAME" RESOURCE_GROUP="$RG_NAME" \ SMARTASSIST_ID="$SMARTASSIST_ID" \ COMPONENT_ID="$COMPONENT_ID"The claddsaapp command could contain other information unrelated to the application framework, variables, and values specific to the application instance such as a path to the application, etc. Name value pairs can overlap, the same name can be used more than once.
- Calls clsapost -v which will run cluster verification
After all of the above steps are completed, the application instance is associated (registered) to the Smart Assist component and the user can then perform modify or delete operations on the application and all of its associated resources as a whole.
Registration script
The zzOther (GASA) Smart Assist does not make use of the REGISTRATION_COMMAND for the GASA component. If it did, when the user added the Smart Assist and the add script called claddsaapp to associate the application instance properties with the application name, the registration command would be invoked as specified in the HACMPsa ODM stanza.