On Tue, 08 Aug 2006 05:56:25 -0600, Alan Robertson wrote:
> Lars Marowsky-Bree wrote:
>> Good morning everyone,
>>
>> I just discussed the upcoming release schedule with Alan, and we want to
>> make the release quick and painless this time.
>>
>> Our current plan is to release 2.0.7 on Thursday.
>>
>> We welcome all testers to report critical or blocking bugs through
>> bugzilla. If you have the option, please give it a spin on your test
>> environment. (Either real or Xen or manual testing...)
>>
>> Please file all bugs you find, even though we might only be able to fix
>> really critical ones before 2.0.7!
>>
>> New features, even new resource agents, will have to wait until next
>> week, when we reopen CVS.
>
> I have tagged 2.0.7 in CVS.
>
> Subsequent commits will not be automatically included in 2.0.7.
>
> If you need something to be included then tell lmb or me, and we'll
> retag the necessary files.
Hi,
I would like the attached two patches considered for inclusion in 2.0.7.
These were part of the big batch of ldirectord patches that I posted
earlier today. However I think they deserve special consideration
as they fix real problems, and have had at least a limited ammount of
testing.
Each patch also has a comment file, which describes what it tries to do.
I'm happy to make the commit myself it that helps, but it will
have to wait until morning.
--
Horms
H: http://www.vergenet.net/~horms/
W: http://www.valinux.co.jp/en/
Don't send email alerts if emailalert is not set
The existing code always tries to send alerts, which is silly at best.
This patch also cleans up the email handling code a bit to isolate
the logic if to send or not.
Signed-off-by: Simon Horman <[EMAIL PROTECTED]>
--- from-0002/ldirectord
+++ to-work/ldirectord 2006-07-17 22:25:11.000000000 -0400
@@ -1834,13 +1834,7 @@ sub ld_main
sleep $CHECKINTERVAL;
}
- my $currenttime=time();
- foreach my $es (@EMAILSTATUS){
- if (($es->{alerttime} > 0 ) && ($currenttime -
$es->{alerttime} >= $es->{emailalertfreq})){
- &ld_emailalert("Inaccessible real server:
$es->{server}", $es->{emailalert});
- &ld_set_email_status($es->{server},
$currenttime);
- }
- }
+ ld_emailalert_resend();
}
}
@@ -2639,18 +2633,14 @@ sub _remove_service {
. "$ipvsadm_args $rforw -w 0");
&ld_log("Quiescent $log_args (Weight set to 0)");
}
- if(defined($$v{emailalert})) {
- &ld_emailalert("Quiescent $log_args (Weight set to
0)",$$v{emailalert});
- &ld_set_email_status($currentserver, $currenttime);
- }
+ &ld_emailalert("Quiescent $log_args (Weight set to 0)",
+ $$v{emailalert}, $currentserver, $currenttime);
}
else {
&system_wrapper("$IPVSADM -d $ipvsadm_args");
&ld_log("Deleted $log_args");
- if(defined($$v{emailalert})) {
- &ld_emailalert("Deleted $log_args",$$v{emailalert});
- &ld_set_email_status($currentserver, $currenttime);
- }
+ &ld_emailalert("Deleted $log_args",$$v{emailalert},
+ $currentserver, $currenttime);
}
}
@@ -2704,19 +2694,16 @@ sub _restore_service {
get_forward_flag($or->{"forward"}) eq $rforw){
&system_wrapper("$IPVSADM -e $ipvsadm_args");
&ld_log("Restored $log_args (Weight set to $rwght)");
- if(defined($$v{emailalert})) {
- &ld_emailalert("Restored $log_args (Weight set
to $rwght)",$$v{emailalert});
- &ld_set_email_status($currentserver, "0");
- }
+ &ld_emailalert("Restored $log_args " .
+ "(Weight set to $rwght)",
+ $$v{emailalert}, $currentserver, 0);
}
}
else {
&system_wrapper("$IPVSADM -a $ipvsadm_args");
&ld_log("Added $log_args (Weight set to $rwght)");
- if(defined($$v{emailalert})) {
- &ld_emailalert("Added $log_args (Weight set to
$rwght)",$$v{emailalert});
- &ld_set_email_status($currentserver, "0");
- }
+ &ld_emailalert("Added $log_args (Weight set to $rwght)",
+ $$v{emailalert}, $currentserver, 0);
}
}
@@ -3043,19 +3030,46 @@ sub ld_log
# 1 on error
sub ld_emailalert
{
- my ($emailsubject,$emailto) = (@_);
- require Mail::Send;
+ my ($emailsubject, $emailto, $currentserver, $currenttime) = (@_);
my $emailmsg;
my $emailfh;
-
+ my $status = 0;
+
+ if ($emailto eq "") {
+ return 0;
+ }
+
+ use Mail::Send;
+
unless ($emailmsg = new Mail::Send Subject=>$emailsubject, To=>$emailto
and $emailfh = $emailmsg->open
and print $emailfh ""
and $emailfh->close) {
&ld_log("failed to send email message\n");
- return 1;
+ $status = 1;
+ }
+
+ &ld_set_email_status($currentserver, $currenttime);
+
+ return($status);
+}
+
+# ld_emailalert_resend
+# Resend email alerts as neccessary
+# pre: none
+# post: EMAILSTATUS array is updated and alears are sent as neccessary
+# return: none
+sub ld_emailalert_resend
+{
+ my $currenttime=time();
+ foreach my $es (@EMAILSTATUS){
+ if ($es->{alerttime} == 0 or
+ $currenttime - $es->{alerttime} < $es->{emailalertfreq}){
+ next;
+ }
+ &ld_emailalert("Inaccessible real server: " . $es->{server},
+ $es->{emailalert}, $es->{server}, $currenttime);
}
- return(0);
}
# ld_set_email_status
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]>
--- from-0001/ldirectord
+++ to-work/ldirectord 2006-07-17 22:15:09.000000000 -0400
@@ -1496,6 +1496,44 @@ sub ld_setup
}
}
+# 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 @@ sub ld_read_ipvsadm
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 @@ sub ld_read_ipvsadm
}
redo;
}
- close(IPVS);
+ close($fh);
return(\%oldsrv);
}
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/