You are here: Administration > Man Pages > LRACI-perform_action(1M)

LRACI-perform_action(1M)

NAME

LRACI-perform_action(1M) - perform a specific action on a resource instance

SYNOPSIS

LKROOT/bin/perform_action [-G] [-s] [-b] [-n] -t tag-name -a action-name[-- arg1 arg2 ... argn]

DESCRIPTION

The LRACI program perform_action finds the resource specified by the tag-name argument of the -t option, then finds the action script specified by the action-name argument of the -a option, and then executes it on the tag-name resource instance. The arguments after the -- argument are passed unchanged to the action script(s). These are arguments that the developer of the action may optionally require in order to use the action. The perform_action program finds the action script by the following algorithm: it first searches in the actions directory for the resource type of the resource instance specified by tag-name:

$LKROOT/subsys/appname/Resources/restypname/actions/action-name

and if not there, it checks the actions directory of the application the resource instance belongs to:

$LKROOT/subsys/appname/actions/action-name

 

The restore and remove actions are special cases for LRACI. The restore action moves an application hierarchy that may be in-service on the remote system to the local system. For restore, the LRACI first checks to make certain that the resource instance tag-name is not already in the ISP state. If it is not, it recursively checks all of the resource instances that this resource depends on, until a resource is found that either depends on no resources, or all of the resources it depends on are already in the ISP state. If the resource was in the ISU state, it is placed in the ISP state. If the resource was in the OSU or OSF state, the LRACI executes the remove script for any affected resources on the remote system. When this completes, the LRACI finds the restore action using the above algorithm and runs it. If the script fails, the resource is marked into the OSF state and the LRACI stops. If it succeeds, the LRACI recursively "restores" the resources up the tree, until the resource specified by tag-name is restored. Then the LRACI recursively checks and "restores" the parent resource instances in a similar fashion until all related root resource instances are restored. In each case, LRACI uses the above algorithm to find the correct restore script using the resource application and resource type of the resource currently being scanned by LRACI, not the resource application and resource type of the tag-name resource.

 

For the remove action, the resources are moved recursively in the opposite direction. The LRACI calls the remove script of all resources starting at the root resources that depend directly or indirectly on the tag-name resource down to, and including, the tag-name resource if any of those resources are in the ISP or ISU state. Resources not in the ISP or ISU state are ignored. If one of the remove scripts fails, the LRACI placed the failing resource into the OSF state and stops. In each case, LRACI uses the above algorithm to find the correct remove script using the resource application and resource type of the resource currently being scanned by LRACI, not the resource application and resource type of the tag-name resource.

 

The remove and restore actions automatically have the -t tag-name and -i ident-field arguments added to the argument list that correspond to the resource instance being acted upon.

-t tag-name

This is the last resource instance that will have its action performed on.

-a action-name

This is the resource action that will be performed.

-s

The default behavior for the restore action is to bring all objects above and below the specified tag into service. The -s option limits the scope of the operation to just the specified tag. A restore action that is invoked with the -s option will fail if there are any out-of-service objects below the specified tag. This option has no effect on the remove action.

 -b

The default behavior for the restore action is to bring all objects above and below the specified tag into service. The -b option changes this behavior to just objects below the specified tag. This option has no effect on the remove action.

-n

This option is only used if the action-name is remove or restore. If this option is not specified, before any remove or restore scripts are executed, the LRACI will check to see if any of the resources on which any of the actions will be run are currently reserved by another process [one can tell if a resource is reserved by running the lcdstatus command as described in LCD(1M). A resource can be reserved while the following operations are being performed on them: a resource "remove from service" is in progress, a "resource restore to service" is in progress, or resource "recovery" is in progress. If any resource is so reserved, LRACI will wait RESRVTIMEOUT seconds for the process to remove the reserve on the resource. RESRVTIMEOUT is a LifeKeeper tunable, defined in the /etc/default/LifeKeeper file that contains a commented description of the tunable. If it waits longer than RESRVTIMEOUT seconds, the LRACI will remove the reserve. In either case, the LRACI will then reserve all of the resources, then follow the algorithm specified above to perform the action(s).

If this option is specified, the resource reserves will not be checked and the actions will be performed whether the resources are reserved or not. Extreme caution should be taken when using this option!

-G

This option is only used if action-name is remove, restore, or delete. If this option is not specified, the LRACI will perform the preglobal and postglobal scripts before and after (respectively) the actions are performed [see LCD(1M)]. If the option is specified, the preglobal and postglobal scripts will not be run.

This option is useful if one needs to run the perform_action more than once, but only wants to run the preglobal and postglobal scripts once.

It is also useful if one needs to run perform_action while creating a resource hierarchy. In that case the preglobal and postglobal scripts should not be run by perform_action because the hierarchy creation scripts should be set up to obtain the "admin lock flags" [see LCDI_flag(1M)] and postrestore also requires the "admin lock flags" which would lead to contention problems.

-- arg1 arg2 ... argn

Argument the resource action developer can optionally define that is passed to the action script. When executing perform_action within a getlocks protected region and the -G option is not used, set arg1 to -m to avoid executing a second instance of getlocks, which would cause the operation to hang.

EXAMPLE

The following is an example of calling an action:

perform_action -t SCSI-USR-DISK -a reset-heads -- -h 7

The LRACI program perform_action would find the action corresponding to reset-heads and execute it with the arguments:

reset-heads -t SCSI-USR-DISK -h 7

EXIT CODES

The following exit codes could be returned by LRACI:

0

The operation has succeeded.

1

A Unix system call or library call has internally returned failure.

2

A user-specified syntax error occurred.

3

The execution of the action has failed.

4

A request to perform an operation on an object that already exists.

5

An argument specified is illegal.

6

Index out-of-range.

7

The action was not found for the specified resource or the specified resource is unknown to LifeKeeper.

8

A request was made to delete a resource instance on which another non-deleted resource instance depends.

9

An attempt to communicate with another system failed.

NOTES

The location of this utility, LKROOT, is defined in the default file /etc/default/LifeKeeper.

FILES

/etc/default/LifeKeeper

© 2012 SIOS Technology Corp., the industry's leading provider of business continuity solutions, data replication for continuous data protection.