cluster: RHEL55 - fence_scsi_test: add debug information
rohara
rohara at fedoraproject.org
Thu Oct 15 14:31:49 UTC 2009
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=5c328396a61fd828c939fa3eea25b763093d0ba1
Commit: 5c328396a61fd828c939fa3eea25b763093d0ba1
Parent: 5fb3efb518b2be4e7f3cd141e1643cb449b8a9c5
Author: Ryan O'Hara <rohara at redhat.com>
AuthorDate: Thu Oct 15 09:29:06 2009 -0500
Committer: Ryan O'Hara <rohara at redhat.com>
CommitterDate: Thu Oct 15 09:29:06 2009 -0500
fence_scsi_test: add debug information
When using the debug (-d) option, print out extra information
such as the actual sg_persist command being invoked to register
and unregister a key/device.
rhbz#516763
---
fence/agents/scsi/fence_scsi_test.pl | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi_test.pl b/fence/agents/scsi/fence_scsi_test.pl
index 59e65f9..65e0c30 100755
--- a/fence/agents/scsi/fence_scsi_test.pl
+++ b/fence/agents/scsi/fence_scsi_test.pl
@@ -16,6 +16,8 @@ $BUILD_DATE="";
sub get_scsi_block_devices
{
+ print "[debug] get_scsi_block_devices\n" if ($opt_d);
+
my $block_dir = "/sys/block";
opendir(DIR, $block_dir) or die "$!\n";
@@ -26,12 +28,16 @@ sub get_scsi_block_devices
for $block_dev (@block_devices)
{
+ print "[debug] \t device = $block_dev\n" if ($opt_d);
+
push(@devices, "/dev/" . $block_dev);
}
}
sub get_cluster_vol_devices
{
+ print "[debug] get_cluster_vol_devices\n" if ($opt_d);
+
my ($in, $out, $err);
my $cmd = "vgs --config 'global { locking_type = 0 }'" .
@@ -51,8 +57,7 @@ sub get_cluster_vol_devices
if ($vg_attr =~ /.*c$/)
{
- ###### DEBUG ######
- print "DEBUG: pv_name = $pv_name\n";
+ print "[debug] \t device = $pv_name\n" if ($opt_d);
push(@devices, $pv_name);
}
@@ -68,7 +73,12 @@ sub register_device
my ($dev, $key) = @_;
my ($in, $out, $err);
+ print "[debug] register_device (device=$dev, key=$key)\n" if ($opt_d);
+
my $cmd = "sg_persist -n -d $dev -o -G -S $key";
+
+ print "[debug] \t cmd = $cmd\n" if ($opt_d);
+
my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
waitpid($pid, 0);
@@ -85,7 +95,12 @@ sub unregister_device
my ($dev, $key) = @_;
my ($in, $out, $err);
+ print "[debug] unregister_device (device=$dev, key=$key)\n" if ($opt_d);
+
my $cmd = "sg_persist -n -d $dev -o -G -K $key -S 0";
+
+ print "[debug] \t cmd = $cmd\n" if ($opt_d);
+
my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
waitpid($pid, 0);
@@ -99,7 +114,7 @@ sub unregister_device
sub test_devices
{
- my $key = "0xDEADBEEF";
+ my $key = "0x1";
foreach $dev (@devices)
{
More information about the cluster-commits
mailing list