cluster/fence/agents/scsi fence_scsi.pl fence_ ...
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: rohara at sourceware.org 2008-01-18 23:02:58
Modified files:
fence/agents/scsi: fence_scsi.pl fence_scsi_test.pl scsi_reserve
Log message:
BZ: 373491, 373511, 373531, 373541, 373571, 429033
BZ: 373491, 373511, 373531, 373541, 373571, 429033
- Prevent "reservation conflict" messageswhen scsi_reserve starts.
- Leave the fence domain if scsi_reserve fails to register with any device.
- Improve logging in scsi_reserve script.
- Use "locking_type = 0" for all lvm commands (ie. vgs).
- Fix SCSI reservations scripts to handle LVM mirrors and stripes.
- Not an error if fence_scsi attempts to remove a non-existent key from a device.
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.6&r2=1.5.2.7
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.2.2&r2=1.1.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/scsi/scsi_reserve.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.8&r2=1.1.2.9
fence/agents/scsi/fence_scsi.pl +34 -42
@@ -11,9 +11,6 @@ s/.*\///; my $pname = $_; -# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and -# "#END_VERSION_GENERATION" It is generated by the Makefile - #BEGIN_VERSION_GENERATION $FENCE_RELEASE_NAME=""; $REDHAT_COPYRIGHT="";
@@ -195,7 +192,6 @@ return $key; } - sub get_options_stdin { my $opt;
@@ -252,7 +248,8 @@ ($dev) = @_; my ($in, $out, $err); - my $cmd = "sg_persist -d $dev -i -k"; + + my $cmd = "sg_persist -n -d $dev -i -k"; my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; waitpid($pid, 0);
@@ -278,46 +275,36 @@ return %key_list; } -#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 { - open(FILE, "/var/run/scsi_reserve") or die "$!\n"; + my ($in, $out, $err); + + my $cmd = "vgs --config 'global { locking_type = 0 }'" . + " --noheadings --separator : -o vg_attr,pv_name"; - while (<FILE>) + my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; + + waitpid($pid, 0); + + die "Unable to execute lvs.\n" if ($?>>8); + + while (<$out>) { chomp; - push(@volumes, $_); + print "OUT: $_\n" if $opt_v; + + my ($vg_attrs, $device) = split(/:/, $_); + + if ($vg_attrs =~ /.*c$/) + { + $device =~ s/\(.*\)//; + push(@volumes, $device); + } } - close FILE; + close($in); + close($out); + close($err); } sub check_sg_persist
@@ -346,7 +333,7 @@ ($dev, $key) = @_; my ($in, $out, $err); - my $cmd = "sg_persist -d $dev -o -G -S $key"; + my $cmd = "sg_persist -n -d $dev -o -G -S $key"; my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; waitpid($pid, 0);
@@ -383,13 +370,18 @@ do_register($dev, $host_key); } + if (!$key_list{$node_key}) + { + next; + } + if ($host_key eq $node_key) { - $cmd = "sg_persist -d $dev -o -G -K $host_key -S 0"; + $cmd = "sg_persist -n -d $dev -o -G -K $host_key -S 0"; } else { - $cmd = "sg_persist -d $dev -o -A -K $host_key -S $node_key -T 5"; + $cmd = "sg_persist -n -d $dev -o -A -K $host_key -S $node_key -T 5"; } my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
@@ -419,7 +411,7 @@ usage if defined $opt_h; version if defined $opt_V; - fail_usage "Unkown parameter." if (@ARGV > 0); + fail_usage "Unknown parameter." if (@ARGV > 0); fail_usage "No '-n' flag specified." unless defined $opt_n;
fence/agents/scsi/fence_scsi_test.pl +86 -86
263 lines not on this page · raw message
fence/agents/scsi/scsi_reserve +207 -125
373 lines not on this page · raw message