From mboxrd@z Thu Jan 1 00:00:00 1970 From: rohara@sourceware.org Date: 27 Nov 2006 23:41:05 -0000 Subject: [Cluster-devel] cluster/fence/agents/scsi scsi_reserve Message-ID: <20061127234105.24882.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Branch: RHEL4 Changes by: rohara at sourceware.org 2006-11-27 23:41:05 Modified files: fence/agents/scsi: scsi_reserve Log message: Remove debug code. Change reporting of failure during 'stop' command. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/scsi/scsi_reserve.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.6.1&r2=1.1.6.2 --- cluster/fence/agents/scsi/scsi_reserve 2006/11/27 22:27:39 1.1.6.1 +++ cluster/fence/agents/scsi/scsi_reserve 2006/11/27 23:41:05 1.1.6.2 @@ -12,10 +12,6 @@ exit 2 fi -# debug -# -echo "debug: found sg_persist" - # check for gethostip command provided by syslinux package # if ! gethostip -h &> /dev/null ; then @@ -23,46 +19,26 @@ exit 3 fi -# debug -# -echo "debug: found gethostip" - # get scsi devices that are part of clustered volumes # scsi_devices=$( lvs -o vg_attr,devices --noheadings \ | awk --posix ' $1 ~ /[-a-z]{5}c/ { print $2 } ' \ | sed -e 's/([0-9]*)//' | sort | uniq ) -# debug -# -for dev in $scsi_devices -do - echo "debug: scsi_device = $dev" -done - # if no scsi devices were found we can exit now # -[ -z "$scsi_devices" ] && exit 0 +[ -z $scsi_devices ] && exit 0 # get the node name and node addr from cman # node_name=$( cman_tool status | grep "Node name" | awk -F": " '{ print $2 }' ) node_addr=$( cman_tool status | grep "Node addr" | awk -F": " '{ print $2 }' ) -# debug -# -echo "debug: node_name = $node_name" -echo "debug: node_addr = $node_addr" - # create unique key for this host # key=$( gethostip -x $node_name ) -# debug -# -echo "debug: key = $key" - -################################################################################ +############################################################################### case $1 in @@ -106,11 +82,13 @@ # for dev in $scsi_devices do + echo -n "Unregistering device: $dev" + + # check if this node/key is the node/key holding the reservation + # if sg_persist -d $dev -i -r 2>/dev/null | grep -qiE "${key#0}" ; then - echo "Unable to unregister device: $dev" error=1 else - echo -n "Unregistering device: $dev" for error in 1 do sg_persist -d $dev -o -G -K $key -S 0 &>/dev/null || break @@ -159,5 +137,5 @@ esac -exit $status +exit $rval