cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: rohara@sourceware.org <rohara@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/fence/agents/scsi fence_scsi_test.pl
Date: 8 Dec 2006 20:48:01 -0000	[thread overview]
Message-ID: <20061208204801.9134.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	rohara at 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;
+



             reply	other threads:[~2006-12-08 20:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-08 20:48 rohara [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-03-06 19:10 [Cluster-devel] cluster/fence/agents/scsi fence_scsi_test.pl rohara
2007-03-06 19:09 rohara
2007-03-06 19:07 rohara
2006-12-08 20:46 rohara
2006-12-08 19:59 rohara

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=20061208204801.9134.qmail@sourceware.org \
    --to=rohara@sourceware.org \
    /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).