#!/bin/ksh #******************************************************************************* # # NAME: add_disk # SUMMARY: %description% # COMPONENT: solsysd # VERSION: rm6_14 # UPDATE DATE: %date_modified: Mon Jun 2 10:38:33 1997 % # PROGRAMMER: %created_by: rjantz % # # Copyright 1997 by Symbios Logic Inc. # # DESCRIPTION: # add_disk carries out those operations needed for SYMplicity storage manager # to be able to see a logical unit (or units). The LUNs may have not been # seen previously for various reasons, e.g., the LUN may have just been # created, or a controller may have just been brought online. # # NOTES: # # REFERENCE: # # CODING STANDARD WAIVERS: # #******************************************************************************* #******************************************************************************* # PROCEDURE: MutexAcquire # SUMMARY: get exclusive ownership of mutex file # # DESCRIPTION: # MutexAcquire will try repeatedly to acquire a "mutex file" - success means # the thread has been admitted to a "critical region" # # SYNTAX: # MutexAcquire # - name of the mutex guarding the critical region # # NOTES: # MutexAcquire and the program it calls, rm_mutex_acquire, rely on O_CREAT # semantics # # RETURNS: # Nothing MutexAcquire() { while true do $RM_HOME/bin/rm_mutex_acquire $1 if [ $? = 0 ] then break; fi sleep 1 done; } #******************************************************************************* # PROCEDURE: MutexRelease # SUMMARY: relenquish mutex file ownership # # DESCRIPTION: # MutexRelease releases mutex file ownership, so another thread can enter the # critical region # # SYNTAX: # MutexRelease # - name of the mutex guarding the critical region # # NOTES: # # RETURNS: # Nothing MutexRelease() { /bin/rm $1; } #******************************************************************************* # PROCEDURE: add_disk (main) # SUMMARY: Make RAID logical units visible # # DESCRIPTION: # add_disk calls symdisks (which in turn runs "drvconfig" and "disks") # to make previously unseen RAID logical units visible to SYMsm and Solaris. # # SYNTAX: # add_disk # # NOTES: # # RETURNS: # 0 - success # non-0 - failure (currently not returned) # A D D _ D I S K M A I N P R O C E D U R E # RMPARAMS_FILE=/etc/raid/rmparams RM_HOME=`grep -v "^#" $RMPARAMS_FILE | grep System_RmHomeDirectory | cut -d= -f2` RM_BOOT_HOME=`grep -v "^#" $RMPARAMS_FILE | grep System_RmBootHomeDirectory | cut -d= -f2` SYMDISKS=$RM_BOOT_HOME/symdisks ADD_RDAC=$RM_HOME/bin/add_rdac RMDEVROOT=`grep -v "^#" $RMPARAMS_FILE | grep "System_AltDevDirRoot" | cut -d= -f2 | awk -F/ '{ ORS = "/"; for (i = NF; i > 1; --i) print $i; ORS = "\n"; print $1 }' | cut -d"/" -f3-32 | awk -F/ '{ ORS = "/"; for (i = NF; i > 1; --i) print $i; ORS = "\n"; print $1 }'` _INIT_RECONFIG=YES; export _INIT_RECONFIG MutexAcquire /tmp/mutex.add_disk # Begin critical region if [ -n "$1" ] then if [ ! -c $RMDEVROOT/dev/rdsk/$1 ] then $SYMDISKS -r $RMDEVROOT -d sd >/dev/null 2>&1 fi else $SYMDISKS -r $RMDEVROOT -d sd >/dev/null 2>&1 fi $ADD_RDAC MutexRelease /tmp/mutex.add_disk # End of critical region exit 0