From 872284c2d382c334dbd6f04ecf7358728d945ce2 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 15 Jan 2008 19:37:30 +0000 Subject: [PATCH] Increase discovery performance and resolve stale blade macmap issue. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@272 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-nbroot/overlay/etc/init.d/S10autodetect | 2 ++ xCAT-server-2.0/lib/xcat/plugins/blade.pm | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/xCAT-nbroot/overlay/etc/init.d/S10autodetect b/xCAT-nbroot/overlay/etc/init.d/S10autodetect index 79244f6f2..dd6ba8fec 100755 --- a/xCAT-nbroot/overlay/etc/init.d/S10autodetect +++ b/xCAT-nbroot/overlay/etc/init.d/S10autodetect @@ -79,3 +79,5 @@ if [ -d /proc/device-tree/lhea* ]; then done fi +#Give 10 seconds for things to quiesce. +sleep 10 diff --git a/xCAT-server-2.0/lib/xcat/plugins/blade.pm b/xCAT-server-2.0/lib/xcat/plugins/blade.pm index 840e9a336..1907827ad 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/blade.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/blade.pm @@ -36,6 +36,7 @@ my %usage = ( "rscan" => "Usage: rscan [-w][-x|-z]" ); my %macmap; #Store responses from rinv for discovery +my $macmaptimestamp; #reflect freshness of cache my $mmprimoid = '1.3.6.1.4.1.2.3.51.2.22.5.1.1.4';#mmPrimary my $beaconoid = '1.3.6.1.4.1.2.3.51.2.2.8.2.1.1.11'; #ledBladeIdentity my $powerstatoid = '1.3.6.1.4.1.2.3.51.2.22.1.5.1.1.4';#bladePowerState @@ -885,7 +886,13 @@ sub process_request { unless ($mac) { return }; #Only refresh the the cache when the request permits and no useful answer - unless ($request->{cacheonly}->[0] or $macmap{$mac}) { + if ($macmaptimestamp < (time() - 300)) { #after five minutes, invalidate cache + %macmap = (); + } + + unless ($request->{cacheonly}->[0] or $macmap{$mac} or $macmaptimestamp > (time() - 20)) { #do not refresh cache if requested not to, if it has an entry, or is recent + %macmap = (); + $macmaptimestamp=time(); process_request(\%invreq,\&fillresps); } unless ($macmap{$mac}) {