public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: "Ryan O'Hara" <rohara@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: master - scsi_reserve: add restart option
Date: Mon, 29 Sep 2008 14:31:00 -0000	[thread overview]
Message-ID: <20080929141557.9C3A8120468@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=d4c5ec99ee91fdca347682bad0d2c1b8ee8cef80
Commit:        d4c5ec99ee91fdca347682bad0d2c1b8ee8cef80
Parent:        88fb54d63ea2575e950e77d48c522ac4bfd1aad1
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 09:15:46 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 6aeccc6..86321f4 100644
--- a/fence/agents/scsi/scsi_reserve
+++ b/fence/agents/scsi/scsi_reserve
@@ -223,6 +223,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


                 reply	other threads:[~2008-09-29 14:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080929141557.9C3A8120468@lists.fedorahosted.org \
    --to=rohara@fedoraproject.org \
    --cc=cluster-cvs-relay@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).