[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH] fence_scsi: always do sg_turs before registration



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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]