From 5f050f6a4937a762874a75ec6b481bc49934c12f Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Mon, 5 Nov 2012 14:36:04 +0000 Subject: [PATCH] Instead of randomizing each retry, just randomize the first to get things spread out then do the triangular progression timeout git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14243 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/IPMI.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/IPMI.pm b/xCAT-server/lib/perl/xCAT/IPMI.pm index ad8eda892..43e5f9336 100644 --- a/xCAT-server/lib/perl/xCAT/IPMI.pm +++ b/xCAT-server/lib/perl/xCAT/IPMI.pm @@ -16,7 +16,7 @@ use warnings "all"; use Time::HiRes qw/time/; use IO::Socket::INET qw/!AF_INET6 !PF_INET6/; -my $initialtimeout=1.0; +my $initialtimeout=0.5; use constant STATE_OPENSESSION=>1; use constant STATE_EXPECTINGRAKP2=>2; use constant STATE_EXPECTINGRAKP4=>3; @@ -461,10 +461,10 @@ sub timedout { return; } $self->{nowait}=1; - $self->{timeout} += 0.5+(0.5*rand()); #$self->{timeout}*2; + $self->{timeout} += 1; #$self->{timeout}*2; if ($self->{noretry}) { return; } if ($self->{timeout} > 5) { #giveup, really - $self->{timeout}=$initialtimeout; + $self->{timeout}=$initialtimeout+(0.5*rand()); my $rsp={}; $rsp->{error} = "timeout"; $self->{ipmicallback}->($rsp,$self->{ipmicallback_args}); @@ -688,7 +688,7 @@ sub init { $self->{'sessionid'} = [0,0,0,0]; # init session id $self->{'authtype'}=0; # first messages will have auth type of 0 $self->{'ipmiversion'}='1.5'; # send first packet as 1.5 - $self->{'timeout'}=$initialtimeout; #start at a quick timeout, increase on retry + $self->{'timeout'}=$initialtimeout+(0.5*rand()); #start at a quick timeout, increase on retry $self->{'seqlun'}=0; #the IPMB seqlun combo, increment by 4s $self->{rqaddr}=0x81; #Per table '5-4' system sofware ids in the ipmi spec, we are allowed 0x81-0x8d software ids #A problem with ipmi is that chatty commands (rinv) can mistake stale data for new if sequence number overflows @@ -864,7 +864,7 @@ sub parse_ipmi_payload { $rsp->{cmd} = shift @payload; $rsp->{code} = shift @payload; $rsp->{data} = \@payload; - $self->{timeout}=$initialtimeout; + $self->{timeout}=$initialtimeout+(0.5*rand()); $self->{ipmicallback}->($rsp,$self->{ipmicallback_args}); return 0; } @@ -980,7 +980,7 @@ sub sendpayload { $sessions_waiting{$self}->{ipmisession}=$self; if ($args{delayxmit}) { $sessions_waiting{$self}->{timeout}=time()+$args{delayxmit}; - $self->{timeout}=$initialtimeout/2; #since we are burning one of the retry attempts, start the backoff algorithm faster to make it come out even + $self->{timeout}=($initialtimeout+(0.5*rand()))/2; #since we are burning one of the retry attempts, start the backoff algorithm faster to make it come out even undef $args{delayxmit}; return; #don't actually transmit packet, use retry timer to start us off } else {