Send Linux-ha-cvs mailing list submissions to linux-ha-cvs@lists.linux-ha.org
To subscribe or unsubscribe via the World Wide Web, visit http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs or, via email, send a message with subject or body 'help' to [EMAIL PROTECTED] You can reach the person managing the list at [EMAIL PROTECTED] When replying, please edit your Subject line so it is more specific than "Re: Contents of Linux-ha-cvs digest..." Today's Topics: 1. Linux-HA CVS: ldirectord by lars from (linux-ha-cvs@lists.linux-ha.org) 2. Linux-HA CVS: heartbeat by davidlee from (linux-ha-cvs@lists.linux-ha.org) 3. Linux-HA CVS: heartbeat by davidlee from (linux-ha-cvs@lists.linux-ha.org) ---------------------------------------------------------------------- Message: 1 Date: Tue, 8 Aug 2006 09:57:10 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org Subject: [Linux-ha-cvs] Linux-HA CVS: ldirectord by lars from To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> linux-ha CVS committal Author : lars Host : Project : linux-ha Module : ldirectord Dir : linux-ha/ldirectord Modified Files: ldirectord Log Message: realine wrapper that really returns lines Net::FTP seems to set the input record separator ($\) to null putting IO into slurp (whole file at a time, rather than line at a time) mode. Net::FTP does this using local $\, which should mean that the change doesn' effect code here, but it does. It also seems to be imposible to turn it off, by say setting $\ back to '\n' Perhaps there is more to this than meets the eye. Perhaps its a perl bug. In any case, this should fix the problem. This should not affect pid or config file parsing as they are called before Net::FTP and as this appears to be a bit of a work around, I'd rather use it in as few places as possible Observed with perl v5.8.8 (Debian's perl 5.8.8-6) Signed-off-by: Simon Horman <[EMAIL PROTECTED]> =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord,v retrieving revision 1.142 retrieving revision 1.143 diff -u -3 -r1.142 -r1.143 --- ldirectord 8 Aug 2006 15:56:39 -0000 1.142 +++ ldirectord 8 Aug 2006 15:57:09 -0000 1.143 @@ -1,5 +1,5 @@ #!/usr/bin/perl -my($VERSION)=(qw$Id: ldirectord,v 1.142 2006/08/08 15:56:39 lars Exp $)[2]; +my($VERSION)=(qw$Id: ldirectord,v 1.143 2006/08/08 15:57:09 lars Exp $)[2]; ###################################################################### # ldirectord http://www.vergenet.net/linux/ldirectord/ @@ -1496,6 +1496,44 @@ } } +# ld_read_ipvsadm +# +# Net::FTP seems to set the input record separator ($\) to null +# putting IO into slurp (whole file at a time, rather than line at a time) +# mode. Net::FTP does this using local $\, which should mean +# that the change doesn' effect code here, but it does. It also +# seems to be imposible to turn it off, by say setting $\ back to '\n' +# Perhaps there is more to this than meets the eye. Perhaps its a perl bug. +# In any case, this should fix the problem. +# +# This should not affect pid or config file parsing as they are called +# before Net::FTP and as this appears to be a bit of a work around, +# I'd rather use it in as few places as possible +# +# Observed with perl v5.8.8 (Debian's perl 5.8.8-6) +# -- Horms, 17th July 2005 +sub ld_readline +{ + my ($fd, $buf) = (@_); + my $line; + + # Uncomment the following line to turn off this work around + # return readline($fd); + + $line = shift @$buf; + if (defined $line) { + return $line . "\n"; + } + + push @$buf, split /\n/, readline($fd); + + $line = shift @$buf; + if (defined $line) { + return $line . "\n"; + } + + return undef; +} # ld_read_ipvsadm # Parses the output of "ipvsadm -L -n" and puts into a structure of @@ -1540,28 +1578,35 @@ my %oldsrv; my $real_service; my $fwd; + my $buf = []; + my $fh; + my $line; # read status of current ipvsadm -L -n - unless(open(IPVS, "$IPVSADM -L -n |")){ + unless(open($fh, "$IPVSADM -L -n 2>&1|")){ &ld_exit(1, "Could not run $IPVSADM -L -n: $!"); } - $_ = <IPVS>; $_ = <IPVS>; $_ = <IPVS>; - while (<IPVS>) { - if ($_ =~ /(\w+)\s+(\d+\.\d+\.\d+\.\d+\:\d+|\d+)\s+(\w+)\s+persistent\s+(\d+)\s+mask\s+(.*)/) { + # Skip the first three lines + $line = ld_readline($fh, $buf); + $line = ld_readline($fh, $buf); + $line = ld_readline($fh, $buf); + + while ($line = ld_readline($fh, $buf)) { + if ($line =~ /(\w+)\s+(\d+\.\d+\.\d+\.\d+\:\d+|\d+)\s+(\w+)\s+persistent\s+(\d+)\s+mask\s+(.*)/) { $real_service = "$2 ".lc($1); $oldsrv{"$real_service"} = {"real"=>{}, "scheduler"=>$3, "persistent"=>$4, "netmask"=>$5}; - } elsif ($_ =~ /(\w+)\s+(\d+\.\d+\.\d+\.\d+\:\d+|\d+)\s+(\w+)\s+persistent\s+(\d+)/) { + } elsif ($line =~ /(\w+)\s+(\d+\.\d+\.\d+\.\d+\:\d+|\d+)\s+(\w+)\s+persistent\s+(\d+)/) { $real_service = "$2 ".lc($1); $oldsrv{"$real_service"} = {"real"=>{}, "scheduler"=>$3, "persistent"=>$4}; - } elsif ($_ =~ /(\w+)\s+(\d+\.\d+\.\d+\.\d+\:\d+|\d+)\s+(\w+)/) { + } elsif ($line =~ /(\w+)\s+(\d+\.\d+\.\d+\.\d+\:\d+|\d+)\s+(\w+)/) { $real_service = "$2 ".lc($1); $oldsrv{"$real_service"} = {"real"=>{}, "scheduler"=>$3}; } else { next; } - while(<IPVS>) { - last unless $_ =~ / ->\s+(\d+\.\d+\.\d+\.\d+\:\d+)\s+(\w+)\s+(\d+)/; + while ($line = ld_readline($fh, $buf)) { + last unless $line =~ / ->\s+(\d+\.\d+\.\d+\.\d+\:\d+)\s+(\w+)\s+(\d+)/; if ($2 eq "Route") { $fwd = "gate"; } elsif ($2 eq "Tunnel") { @@ -1573,7 +1618,7 @@ } redo; } - close(IPVS); + close($fh); return(\%oldsrv); } ------------------------------ Message: 2 Date: Tue, 8 Aug 2006 10:03:50 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org Subject: [Linux-ha-cvs] Linux-HA CVS: heartbeat by davidlee from To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> linux-ha CVS committal Author : davidlee Host : Project : linux-ha Module : heartbeat Dir : linux-ha/heartbeat/init.d Modified Files: heartbeat.in Log Message: make 'tr' arguments portable across different 'tr' implementations =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/heartbeat/init.d/heartbeat.in,v retrieving revision 1.44 retrieving revision 1.45 diff -u -3 -r1.44 -r1.45 --- heartbeat.in 8 Aug 2006 13:29:34 -0000 1.44 +++ heartbeat.in 8 Aug 2006 16:03:49 -0000 1.45 @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: heartbeat.in,v 1.44 2006/08/08 13:29:34 lars Exp $ +# $Id: heartbeat.in,v 1.45 2006/08/08 16:03:49 davidlee Exp $ # # heartbeat Start high-availability services # @@ -122,7 +122,7 @@ fi CrmEnabled() { - case `ha_parameter crm | tr A-Z a-z` in + case `ha_parameter crm | tr '[A-Z]' '[a-z]'` in y|yes|enable|on|true|1|manual) true;; *) false;; esac @@ -319,8 +319,8 @@ } StandbyHA() { - auto_failback=`ha_parameter auto_failback | tr 'A-Z' 'a-z'` - nice_failback=`ha_parameter nice_failback | tr 'A-Z' 'a-z'` + auto_failback=`ha_parameter auto_failback | tr '[A-Z]' '[a-z]'` + nice_failback=`ha_parameter nice_failback | tr '[A-Z]' '[a-z]'` case "$auto_failback" in *legacy*) echo "auto_failback is set to legacy. Cannot enter standby." @@ -450,6 +450,9 @@ # # # $Log: heartbeat.in,v $ +# Revision 1.45 2006/08/08 16:03:49 davidlee +# make 'tr' arguments portable across different 'tr' implementations +# # Revision 1.44 2006/08/08 13:29:34 lars # Consolidate check and make it work on Solaris too (hopefully). # ------------------------------ Message: 3 Date: Tue, 8 Aug 2006 11:00:59 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org Subject: [Linux-ha-cvs] Linux-HA CVS: heartbeat by davidlee from To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> linux-ha CVS committal Author : davidlee Host : Project : linux-ha Module : heartbeat Dir : linux-ha/heartbeat Modified Files: shellfuncs.in Log Message: rev 1.24 introduced non-terminated shell function =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/heartbeat/shellfuncs.in,v retrieving revision 1.24 retrieving revision 1.25 diff -u -3 -r1.24 -r1.25 --- shellfuncs.in 7 Aug 2006 18:42:51 -0000 1.24 +++ shellfuncs.in 8 Aug 2006 17:00:59 -0000 1.25 @@ -67,6 +67,7 @@ echo failure fi return $stat +} hadate() { ------------------------------ _______________________________________________ Linux-ha-cvs mailing list Linux-ha-cvs@lists.linux-ha.org http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs End of Linux-ha-cvs Digest, Vol 33, Issue 8 *******************************************