public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* RHEL5 - scsi_reserve: add restart option
@ 2008-09-05 21:47 Ryan O'Hara
  0 siblings, 0 replies; only message in thread
From: Ryan O'Hara @ 2008-09-05 21:47 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=4030e990049b43a125a083ed994629c6c8409e0c
Commit:        4030e990049b43a125a083ed994629c6c8409e0c
Parent:        a37692ca2e979b71012653676141d807a307a217
Author:        rohara <rohara@spartan.(none)>
AuthorDate:    Fri Sep 5 16:34:51 2008 -0500
Committer:     rohara <rohara@spartan.(none)>
CommitterDate: Fri Sep 5 16:34:51 2008 -0500

scsi_reserve: add restart option

Added restart option to scsi_reserve init script. Using this option
will result is re-registering with all devices. It will not remove
any existing registrations, since doing so would be dangerous. In
short, it is nearly identical to calling the script with the "start"
option. (BZ #455330)
---
 fence/agents/scsi/scsi_reserve |   55 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/fence/agents/scsi/scsi_reserve b/fence/agents/scsi/scsi_reserve
index 67c0d2d..34f25e5 100755
--- a/fence/agents/scsi/scsi_reserve
+++ b/fence/agents/scsi/scsi_reserve
@@ -219,6 +219,61 @@ case $1 in
 
 	;; # end of stop
 
+    restart)
+
+	error=0
+
+	echo -n "Retarting scsi_reserve:"
+
+	for dev in $scsi_devices
+	do
+	  # recreate the scsi registration
+	  #
+	  if ! sg_persist -n -d $dev -o -I -S $key &> /dev/null ; then
+	      logger -t scsi_reserve \
+		"[error] unable to register device $dev (key=0x$key)"
+	      : $[ count = $count + 1 ]
+	      error=1
+	  else
+	      logger -t scsi_reserve \
+		"[info] registered with device $dev (key=0x$key)"
+	  fi
+
+	  # check to see if reservation already exists
+	  #
+	  if sg_persist -n -d $dev -i -r | grep -qiE "^[[:space:]]*Key=0x" ; then
+	      logger -t scsi_reserve \
+		"[info] reservation already exists on $dev"
+	      continue
+	  fi
+
+	  # recreate the scsi reservation
+	  #
+	  if ! sg_persist -n -d $dev -o -R -K $key -T 5 &> /dev/null ; then
+	      logger -t scsi_reserver \
+		"[error] unable to create reservation on $dev (key=0x$key)"
+	      : $[ count = $count + 1 ]
+	      error=1
+	  fi
+	done
+
+	# leave fence domain if any errors occured during registration
+	#
+	if [ $error -eq 0 ] ; then
+	    success
+	else
+	    logger -t scsi_reserve \
+		"[info] $count errors during registration"
+	    logger -t scsi_reserve \
+		"[info] leaving the fence domain"
+	    fence_tool leave
+	    failure
+	fi
+
+	echo
+
+	;; # end of restart
+
     status)
 
 	error=0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-09-05 21:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-05 21:47 RHEL5 - scsi_reserve: add restart option Ryan O'Hara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).