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

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=2468574b5056b45b26787db1e89664abefab043c
Commit:        2468574b5056b45b26787db1e89664abefab043c
Parent:        d5318d9d6b5f1267de2a340fb89fbf56cf9c6203
Author:        rohara <rohara@spartan.(none)>
AuthorDate:    Fri Sep 5 16:34:51 2008 -0500
Committer:     Ryan O'Hara <rohara@redhat.com>
CommitterDate: Mon Sep 29 08:28:25 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 00fc650..a376b97 100644
--- a/fence/agents/scsi/scsi_reserve
+++ b/fence/agents/scsi/scsi_reserve
@@ -232,6 +232,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-29 13:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-29 13:30 STABLE2 - 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).