public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* RHEL5 - fence_scsi: improve logging for debugging
@ 2008-09-10 21:57 Ryan O'Hara
0 siblings, 0 replies; only message in thread
From: Ryan O'Hara @ 2008-09-10 21:57 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=a126bc9b948cce3f762c5b73cdf00d326c2752ec
Commit: a126bc9b948cce3f762c5b73cdf00d326c2752ec
Parent: 74721309f73dc6dc38abd07dc7c08e0ecb8ec602
Author: Ryan O'Hara <rohara@redhat.com>
AuthorDate: Wed Sep 10 16:55:04 2008 -0500
Committer: Ryan O'Hara <rohara@redhat.com>
CommitterDate: Wed Sep 10 16:55:04 2008 -0500
fence_scsi: improve logging for debugging
Using the -v (verbose) option will print more information that it
previously did. Output will also be easier to understand, which
should help track down any problems that might occur.
---
fence/agents/scsi/fence_scsi.pl | 91 ++++++++++++++++++++++++++------------
1 files changed, 62 insertions(+), 29 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index a1e5246..fd06031 100755
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -5,7 +5,7 @@ use XML::LibXML;
use IPC::Open3;
use POSIX;
-my @volumes;
+my @device_list;
$_ = $0;
s/.*\///;
@@ -75,7 +75,6 @@ sub get_cluster_id
while (<$out>)
{
chomp;
- print "OUT: $_\n" if $opt_v;
my ($name, $value) = split(/\s*:\s*/, $_);
@@ -90,6 +89,8 @@ sub get_cluster_id
close($out);
close($err);
+ print "[$pname]: get_cluster_id: cluster_id=$cluster_id\n" if $opt_v;
+
return $cluster_id;
}
@@ -104,11 +105,15 @@ sub get_node_id
my $node_id = $tree->findvalue($xpath);
+ print "[$pname]: get_node_id ($node): node_id=$node_id\n" if $opt_v;
+
return $node_id;
}
sub get_node_name
{
+ print "[$pname]: get_hode_name: node_name=$opt_n\n" if $opt_v;
+
return $opt_n;
}
@@ -128,7 +133,6 @@ sub get_host_id
while (<$out>)
{
chomp;
- print "OUT: $_\n" if $opt_v;
my ($name, $value) = split(/\s*:\s*/, $_);
@@ -143,6 +147,8 @@ sub get_host_id
close($out);
close($err);
+ print "[$pname]: get_host_id: host_id=$host_id\n" if $opt_v;
+
return $host_id;
}
@@ -162,7 +168,6 @@ sub get_host_name
while (<$out>)
{
chomp;
- print "OUT: $_\n" if $opt_v;
my ($name, $value) = split(/\s*:\s*/, $_);
@@ -177,6 +182,8 @@ sub get_host_name
close($out);
close($err);
+ print "[$pname]: get_host_name: host_name=$host_name\n" if $opt_v;
+
return $host_name;
}
@@ -193,6 +200,8 @@ sub get_key
my $key = sprintf "%x%.4x", $cluster_id, $node_id;
+ print "[$pname]: get_key ($node): key=$key\n" if $opt_v;
+
return $key;
}
@@ -253,7 +262,7 @@ sub get_key_list
my ($in, $out, $err);
- my $cmd = "sg_persist -n -d $dev -i -k";
+ my $cmd = "sg_persist -d $dev -i -k";
my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
waitpid($pid, 0);
@@ -272,6 +281,22 @@ sub get_key_list
}
}
+ # DEBUG: use -v option
+ #
+ if ($opt_v)
+ {
+ my $count = keys %key_list;
+ my $index = 0;
+
+ print "[$pname]: get_key_list: found $count keys registered with $dev\n";
+
+ for $key (keys %key_list)
+ {
+ print "[$pname]: ($index) key=$key\n";
+ $index++;
+ }
+ }
+
close($in);
close($out);
close($err);
@@ -290,19 +315,34 @@ sub get_scsi_devices
waitpid($pid, 0);
- die "Unable to execute lvs.\n" if ($?>>8);
+ die "Unable to execute vgs.\n" if ($?>>8);
while (<$out>)
{
chomp;
- print "OUT: $_\n" if $opt_v;
- my ($vg_attrs, $device) = split(/:/, $_);
+ my ($vg_attrs, $dev) = split(/:/, $_);
if ($vg_attrs =~ /.*c$/)
{
- $device =~ s/\(.*\)//;
- push(@volumes, $device);
+ $dev =~ s/\(.*\)//;
+ push(@device_list, $dev);
+ }
+ }
+
+ # DEBUG: use -v flag
+ #
+ if ($opt_v)
+ {
+ my $count = scalar @device_list;
+ my $index = 0;
+
+ print "[$pname]: get_scsi_devices: found $count devices\n";
+
+ for $dev (@device_list)
+ {
+ print "[$pname]: ($index) dev=$dev\n";
+ $index++;
}
}
@@ -321,12 +361,6 @@ sub check_sg_persist
die "Unable to execute sg_persist.\n" if ($?>>8);
- while (<$out>)
- {
- chomp;
- print "OUT: $_\n" if $opt_v;
- }
-
close($in);
close($out);
close($err);
@@ -344,12 +378,6 @@ sub do_register
die "Unable to execute sg_persist ($dev).\n" if ($?>>8);
- while (<$out>)
- {
- chomp;
- print "OUT: $_\n" if $opt_v;
- }
-
close($in);
close($out);
close($err);
@@ -365,10 +393,17 @@ sub fence_node
my ($in, $out, $err);
- foreach $dev (@volumes)
+ foreach $dev (@device_list)
{
my %key_list = get_key_list($dev);
+ # DEBUG: use -v option
+ #
+ if ($opt_v)
+ {
+ print "[$pname]: unregister key 0x$node_key from device $dev\n";
+ }
+
if (!$key_list{$host_key})
{
do_register($dev, $host_key);
@@ -376,6 +411,10 @@ sub fence_node
if (!$key_list{$node_key})
{
+ if ($opt_v)
+ {
+ print "[$pname]: key 0x$node_key is not registered with device $dev\n";
+ }
next;
}
@@ -394,12 +433,6 @@ sub fence_node
die "Unable to execute sg_persist ($dev).\n" if ($?>>8);
- while (<$out>)
- {
- chomp;
- print "OUT: $_\n" if $opt_v;
- }
-
close($in);
close($out);
close($err);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-09-10 21:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-10 21:57 RHEL5 - fence_scsi: improve logging for debugging 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).