Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
27.  Dynamically Configuring Devices (Tasks) Reconfiguration Coordination Manager (RCM) Script Overview How Does the RCM Script Process Work? RCM Script Processing Environment  Previous   Contents   Next 
   
 

RCM Script Tasks

The following sections describe the RCM script tasks for application developers and system administrators.

Application Developer RCM Script (Task Map)

The following task map describes the tasks for an application developer who is creating an RCM script.

Task

Description

For Instructions

1. Identify resources your application uses

Identify the resources (device names) your application uses that you could potentially dynamically remove.

cfgadm(1M)

2. Identify commands to release the resource

Identify the commands for notifying the application to cleanly release the resource from the application.

Application documentation

3. Identify commands for post-removal of the resource

Include the commands for notifying the application of the resource removal.

rcmscript(4)

4. Identify commands if the resource removal fails

Include the commands for notifying the application of the available resource.

rcmscript(4)

5. Write the RCM script

Write the RCM script based on the information identified in the previous tasks.

"Tape Backup RCM Script Example"

6. Install the RCM script

Add the script to the appropriate script directory.

"How to Install an RCM Script"

7. Test the RCM script

Test the script by running the script commands manually and by initiating a dynamic reconfiguration operation.

"How to Test an RCM Script"

System Administrator RCM Script (Task Map)

The following task map describes the tasks for a system administrator who is creating an RCM script to do site customization.

Task

Description

For Instructions

1. Identify resources to be dynamically removed

Identify the resources (device names) to be potentially removed by using the cfgadm -l command.

cfgadm(1M)

2. Identify applications to be stopped

Identify the commands for stopping the applications cleanly.

Application documentation

3. Identify commands for pre-removal and post-removal of the resource

Identify the actions to be taken before and after the resource is removed.

rcmscript(4)

4. Write the RCM script

Write the RCM script based on the information identified in the previous tasks.

"Tape Backup RCM Script Example"

5. Install the RCM script

Add the script to the appropriate script directory.

"How to Install an RCM Script"

6. Test the RCM script

Test the script by running the script commands manually and by initiating a dynamic reconfiguration operation.

"How to Test an RCM Script"

Naming an RCM Script

A script must be named as vendor,service where the following applies:

vendor

Is the stock symbol of the vendor that provides the script, or any distinct name that identifies the vendor.

service

Is the name of the service that the script represents.

Installing or Removing an RCM Script

You must be superuser (root) to install or remove an RCM script. Use this table to determine where you should install your RCM script.

Table 27-1 RCM Script Directories

Directory Location

Script Type

/etc/rcm/scripts

Scripts for specific systems

/usr/platform/`uname -i`/lib/rcm/scripts

Scripts for a specific hardware implementation

/usr/platform/`uname -m`/lib/rcm/scripts

Scripts for a specific hardware class

/usr/lib/rcm/scripts

Scripts for any hardware

How to Install an RCM Script

  1. Become superuser.

  2. Copy the script to the appropriate directory as described in Table 27-1.

    For example:

    # cp SUNW,sample.pl /usr/lib/rcm/scripts
  3. Change the user ID and the group ID of the script to the desired values.

    # chown user:group /usr/lib/rcm/scripts/SUNW,sample.pl
  4. Send SIGHUP to the RCM daemon.

    # pkill -HUP -x -u root rcm_daemon

How to Remove an RCM Script

  1. Become superuser.

  2. Remove the script from the RCM script directory.

    For example:

    # rm /usr/lib/rcm/scripts/SUNW,sample.pl 
  3. Send SIGHUP to the RCM daemon.

    # pkill -HUP -x -u root rcm_daemon

How to Test an RCM Script

  1. Set environment variables, such as RCM_ENV_FORCE, in the command-line shell before running your script.

    For example, in the Korn shell, use the following:

    $ export RCM_ENV_FORCE=TRUE
  2. Test the script by running the script commands manually from the command line.

    For example:

    $ script-name scriptinfo
    $ script-name register
    $ script-name preremove resource-name
    $ script-name postremove resource-name
  3. Make sure each RCM script command in your script prints appropriate output to stdout.

  4. Install the script in the appropriate script directory.

    For more information, see "How to Install an RCM Script".

  5. Test the script by initiating a dynamic remove operation:

    For example, assume your script registers the device, /dev/dsk/c1t0d0s0. Try these commands.

    $ cfgadm -c unconfigure c1::dsk/c1t0d0
    $ cfgadm -f -c unconfigure c1::dsk/c1t0d0
    $ cfgadm -c configure c1::dsk/c1t0d0

    Caution - Make sure that you are familiar with these commands because they can alter the state of the system and can cause system failures.


Tape Backup RCM Script Example

This example illustrates how to use an RCM script for tape backups.

What the Tape Backup RCM Script Does

The tape backup RCM script performs the following steps:

  1. Sets up a dispatch table of RCM commands.

  2. Calls the dispatch routine that corresponds to the specified RCM command and exits with status 2 for unimplemented RCM commands.

  3. Sets up the scriptinfo section:

    rcm_script_func_info=Tape backup appl script for DR
  4. Registers all tape drives in the system by printing all tape drive device names to stdout.
    rcm_resource_name=/dev/rmt/$f
    If an error occurs, prints the error information to stdout.

    rcm_failure_reason=$errmsg
  5. Sets up the resource information for the tape device.

    rcm_resource_usage_info=Backup Tape Unit Number $unit
  6. Sets up the preremove information by checking if the backup application is using the device. If the backup application is not using the device, the dynamic reconfiguration operation continues. If the backup application is using the device, the script checks RCM_ENV_FORCE. If RCM_ENV_FORCE is set to FALSE, the script denies the dynamic reconfiguration operation and prints the following message:

    rcm_failure_reason=tape backup in progress pid=...

    If RCM_ENV_FORCE is set to TRUE, the backup application is stopped, and the reconfiguration operation proceeds.

 
 
 
  Previous   Contents   Next