From 3ebe911473c90229647bf1f19230398037e212b0 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Wed, 24 Jan 2018 06:50:32 -0500 Subject: [PATCH] enhance of fix for issue 4652 --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 003c139e3..c4f1e2d5c 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -47,6 +47,7 @@ my $bmc_user; my $bmc_pass; my $openbmc_user; my $openbmc_pass; +my $done_num = 0; $::P9_WITHERSPOON_MFG_ID = "42817"; $::P9_WITHERSPOON_PRODUCT_ID = "16975"; @@ -724,6 +725,12 @@ sub scan_process { while($children > 0) { sleep(1); } + unless ($done_num) { + my %rsp; + $rsp{data} = ["No bmc found.\n"]; + xCAT::MsgUtils->message("W", \%rsp, $::CALLBACK); + } + } else { @@ -855,18 +862,12 @@ sub forward_data { if (!($@ and $@ =~ /^Magic number checking on storable file/)) { #this most likely means we ran over the end of available input $callback->($responses); } - my $num = 0; eval { $responses = fd_retrieve($cfd); if ($responses->{data}) { - $num += $responses->{data}; + $done_num += $responses->{data}; } }; - unless ($num) { - my %rsp; - $rsp{data} = ["No bmc found.\n"]; - xCAT::MsgUtils->message("W", \%rsp, $::CALLBACK); - } }