Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > d236c5da97a239a1b6991cfba2865b66 > files > 81

cman-2.0.115-68.el5_6.1.src.rpm

commit 5c328396a61fd828c939fa3eea25b763093d0ba1
Author: Ryan O'Hara <rohara@redhat.com>
Date:   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

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)
     {