From: Ryan O'Hara <rohara@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 2/2] fence_scsi: verify that on/off actions succeed
Date: Mon, 24 Jan 2011 13:56:28 -0600 [thread overview]
Message-ID: <1295898988-21925-1-git-send-email-rohara@redhat.com> (raw)
This patch adds code to verify that both "on" and "off" actions are
successful. This is needed because there seem to be some arrays that
do not report an error even when no registration was created, etc.
These verification steps takes places after the action has been
performed successfully. If an error was encountered while performing
either an "on" or "off" action, fence_scsi will exit and no verification
will take place. Failure to verify that an action was successful for any
device will result is failure.
For the "on" action, do_verify_on will check that the key was
successfully registered with each devices and that a reservation exists
on each device.
For the "off" action, do_verify_off will check that the key was removed
from each device and that a reservation exists on each device.
Resolves: rhbz#644385
Signed-off-by: Ryan O'Hara <rohara@redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 58 +++++++++++++++++++++++++++++++++++++++
1 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 5156881..2bc05df 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -110,6 +110,62 @@ sub do_action_status ($@)
}
}
+sub do_verify_on ($@)
+{
+ my $self = (caller(0))[3];
+ my ($node_key, @devices) = @_;
+ my $count = 0;
+
+ for $dev (@devices) {
+ my @keys = grep { /^$node_key$/ } get_registration_keys ($dev);
+
+ ## check that our key is registered
+ if (scalar (@keys) == 0) {
+ log_debug ("failed to register key $node_key on device $dev");
+ $count++;
+ next;
+ }
+
+ ## check that a reservation exists
+ if (!get_reservation_key ($dev)) {
+ log_debug ("no reservation exists on device $dev");
+ $count++;
+ }
+ }
+
+ if ($count != 0) {
+ log_error ("$self: failed to verify $count devices");
+ }
+}
+
+sub do_verify_off ($@)
+{
+ my $self = (caller(0))[3];
+ my ($node_key, @devices) = @_;
+ my $count = 0;
+
+ for $dev (@devices) {
+ my @keys = grep { /^$node_key$/ } get_registration_keys ($dev);
+
+ ## check that our key is not registered
+ if (scalar (@keys) != 0) {
+ log_debug ("failed to remove key $node_key from device $dev");
+ $count++;
+ next;
+ }
+
+ ## check that a reservation exists
+ if (!get_reservation_key ($dev)) {
+ log_debug ("no reservation exists on device $dev");
+ $count++;
+ }
+ }
+
+ if ($count != 0) {
+ log_error ("$self: failed to verify $count devices");
+ }
+}
+
sub do_register ($$$)
{
my $self = (caller(0))[3];
@@ -668,9 +724,11 @@ if (!defined $opt_o) {
##
if ($opt_o =~ /^on$/i) {
do_action_on ($key, @devices);
+ do_verify_on ($key, @devices);
}
elsif ($opt_o =~ /^off$/i) {
do_action_off ($key, @devices);
+ do_verify_off ($key, @devices);
}
elsif ($opt_o =~ /^status/i) {
do_action_status ($key, @devices);
--
1.7.3.4
next reply other threads:[~2011-01-24 19:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-24 19:56 Ryan O'Hara [this message]
2011-01-24 20:50 ` [Cluster-devel] [PATCH 2/2] fence_scsi: verify that on/off actions succeed Lon Hohberger
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=1295898988-21925-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).