cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Ryan O'Hara <rohara@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] fence_scsi: always do sg_turs before registration
Date: Mon, 24 Jan 2011 12:57:58 -0600	[thread overview]
Message-ID: <1295895478-20961-1-git-send-email-rohara@redhat.com> (raw)

This patch fixes a with the original patch posted last week. Before
attempting to register with a device, we should call sg_turs on the
device. If that device is a dm-multipath device, we should call sg_turs
on all the paths. This can be done by simply moving the call to do_reset
to do_register and do_register_ignore.

Also, the patch adds a call to do_reset before doing a "status" action.
If a node has been fenced and then proceeds to check its status, it will
be in "unit attention" state.

Resolves: rhbz#640343

Signed-off-by: Ryan O'Hara <rohara@redhat.com>
---
 fence/agents/scsi/fence_scsi.pl |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 10dc26a..5156881 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -46,7 +46,6 @@ sub do_action_on ($@)
 	log_error ("device $dev does not exist") if (! -e $dev);
 	log_error ("device $dev is not a block device") if (! -b $dev);
 
-	do_reset ($dev);
 	do_register_ignore ($node_key, $dev);
 
 	if (!get_reservation_key ($dev)) {
@@ -94,6 +93,8 @@ sub do_action_status ($@)
 	log_error ("device $dev does not exist") if (! -e $dev);
 	log_error ("device $dev is not a block device") if (! -b $dev);
 
+	do_reset ($dev);
+
 	my @keys = grep { /^$node_key$/ } get_registration_keys ($dev);
 
 	if (scalar (@keys) != 0) {
@@ -129,6 +130,8 @@ sub do_register ($$$)
     my $cmd;
     my $out;
 
+    do_reset ($dev);
+
     $cmd = "sg_persist -n -o -G -K $host_key -S $node_key -d $dev";
     $cmd .= " -Z" if (defined $opt_a);
     $out = qx { $cmd };
@@ -158,11 +161,13 @@ sub do_register_ignore ($$)
     my $cmd;
     my $out;
 
+    do_reset ($dev);
+
     $cmd = "sg_persist -n -o -I -S $node_key -d $dev";
     $cmd .= " -Z" if (defined $opt_a);
     $out = qx { $cmd };
 
-    die "[error]: $self\n" if ($?>>8);
+    die "[error]: $self ($dev)\n" if ($?>>8);
 
     return;
 }
-- 
1.7.3.4



             reply	other threads:[~2011-01-24 18:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 18:57 Ryan O'Hara [this message]
2011-01-24 20:51 ` [Cluster-devel] [PATCH] fence_scsi: always do sg_turs before registration Lon Hohberger
2011-01-24 20:57   ` Ryan O'Hara

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=1295895478-20961-1-git-send-email-rohara@redhat.com \
    --to=rohara@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 NNTP newsgroup(s).