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

[Cluster-devel] cluster/fence/agents/scsi fence_scsi_test.pl



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	rohara sourceware org	2006-12-08 20:48:00

Modified files:
	fence/agents/scsi: fence_scsi_test.pl 

Log message:
	Fix code to use get_key subroutine.
	Fix sg_persist commands to specify device via -d parameter.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/scsi/fence_scsi_test.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1&r2=1.1.2.1

--- cluster/fence/agents/scsi/fence_scsi_test.pl	2006/11/03 17:31:54	1.1
+++ cluster/fence/agents/scsi/fence_scsi_test.pl	2006/12/08 20:48:00	1.1.2.1
@@ -19,6 +19,7 @@
 
 sub get_key
 {
+    my $name = @_;
     my $addr = gethostbyname($name) or die "$!\n";
 
     return unpack("H*", $addr);
@@ -32,7 +33,7 @@
     print "DEBUG: $func ($dev, $key)\n" if ($opt_d);
 
     my ($in, $out, $err);
-    my $cmd = "sg_persist $dev -o -G -S $key";
+    my $cmd = "sg_persist -d $dev -o -G -S $key";
 
     my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
 
@@ -42,7 +43,7 @@
 
     $results{$dev}[0] = $rval;
 
-    print "DEBUG: [$rval] $cmd\n" if $opt_d;
+    print "DEBUG: [$rval] $cmd\n" if ($opt_d);
 
     close($in);
     close($out);
@@ -56,10 +57,10 @@
     my $func = (caller(0))[3];
     my ($dev, $key) = @_;
 
-    print "DEBUG: $func ($dev, $key)\n" if $opt_d;
+    print "DEBUG: $func ($dev, $key)\n" if ($opt_d);
 
     my ($in, $out, $err);
-    my $cmd = "sg_persist $dev -o -G -K $key -S 0";
+    my $cmd = "sg_persist -d $dev -o -G -K $key -S 0";
 
     my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
 
@@ -69,7 +70,7 @@
 
     $results{$dev}[1] = $rval;
 
-    print "DEBUG: [$rval] $cmd\n" if $opt_d;
+    print "DEBUG: [$rval] $cmd\n" if ($opt_d);
 
     close($in);
     close($out);
@@ -98,6 +99,7 @@
 {
     my ($in, $out, $err);
     my $cmd = "lvs --noheadings --separator : -o vg_attr,devices";
+
     my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
 
     waitpid($pid, 0);
@@ -108,7 +110,7 @@
     {
 	chomp;
 
-	my ($vg_attr, $dev) = split /:/, $_, 3;
+	my ($vg_attr, $dev) = split(/:/, $_);
 
 	if ($vg_attr =~ /.*c$/)
 	{
@@ -125,8 +127,7 @@
 sub test_devices
 {
     my $name = hostname() or die "$!\n";
-    my $addr = gethostbyname($name) or die "$!\n";
-    my $key = unpack("H*", $addr);
+    my $key = get_key($name);
 
     foreach $dev (@devices)
     {
@@ -195,7 +196,7 @@
     print "  -h     Help. Prints out this usage information.\n\n";
 }
 
-### main ###
+### MAIN #######################################################
 
 if (getopts("cdhsv") == 0)
 {
@@ -232,3 +233,5 @@
 
 print_results;
 
+exit 0;
+


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