[Cluster-devel] cluster/fence/agents/scsi fence_scsi.pl
rohara at sourceware.org
rohara at sourceware.org
Tue Dec 12 22:22:52 UTC 2006
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: rohara at sourceware.org 2006-12-12 22:22:51
Modified files:
fence/agents/scsi: fence_scsi.pl
Log message:
Rewrite of get_scsi_devices function.
It is no longer possible to use lvs to get a list of cluster volumes (and
underlying devices) at fence time. For this reason we must "keep state"
by recording which devices we register with at startup. The init script
(scsi_reserve) will record each device it successfully registered with to
a file (/var/run/scsi_reserve). Then, and fence time, the fence_scsi agent
will unregister each device listed in the state file.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/scsi/fence_scsi.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5.2.2&r2=1.5.2.3
--- cluster/fence/agents/scsi/fence_scsi.pl 2006/12/08 21:23:00 1.5.2.2
+++ cluster/fence/agents/scsi/fence_scsi.pl 2006/12/12 22:22:51 1.5.2.3
@@ -156,33 +156,46 @@
}
}
+#sub get_scsi_devices
+#{
+# 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);
+#
+# die "Unable to execute lvs.\n" if ($?>>8);
+#
+# while (<$out>)
+# {
+# chomp;
+# print "OUT: $_\n" if $opt_v;
+#
+# my ($vg_attrs, $device) = split(/:/, $_);
+#
+# if ($vg_attrs =~ /.*c$/)
+# {
+# $device =~ s/\(.*\)//;
+# push @volumes, $device;
+# }
+# }
+#
+# close($in);
+# close($out);
+# close($err);
+#}
+
sub get_scsi_devices
{
- 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);
-
- die "Unable to execute lvs.\n" if ($?>>8);
+ open(FILE, "/var/run/scsi_reserve") or die "$!\n";
- while (<$out>)
+ while (<FILE>)
{
chomp;
- print "OUT: $_\n" if $opt_v;
-
- my ($vg_attrs, $device) = split(/:/, $_);
-
- if ($vg_attrs =~ /.*c$/)
- {
- $device =~ s/\(.*\)//;
- push @volumes, $device;
- }
+ push(@volumes, $_);
}
- close($in);
- close($out);
- close($err);
+ close FILE;
}
sub check_sg_persist
More information about the Cluster-devel
mailing list