From feaa1532ecc1d50d4a530bbbe1c6c808465b85ea Mon Sep 17 00:00:00 2001 From: xuweibj Date: Fri, 9 Mar 2018 18:30:46 +0800 Subject: [PATCH] Not start agent when no valid nodes (#4915) --- xCAT-server/lib/xcat/plugins/openbmc2.pm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc2.pm b/xCAT-server/lib/xcat/plugins/openbmc2.pm index 1a3cac6e6..f4c750777 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc2.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc2.pm @@ -121,12 +121,6 @@ sub process_request { xCAT::MsgUtils->message("E", { data => ["The xCAT Python agent does not exist. Check if xCAT-openbmc-py package is installed on management node and service nodes."] }, $callback); return; } - # If we can't start the python agent, exit immediately - my $pid = xCAT::OPENBMC::start_python_agent(); - if (!defined($pid)) { - xCAT::MsgUtils->message("E", { data => ["Failed to start the xCAT Python agent. Check /var/log/xcat/cluster.log for more information."] }, $callback); - return; - } my $noderange = $request->{node}; my $check = parse_node_info($noderange); @@ -137,6 +131,13 @@ sub process_request { $callback->({ errorcode => [$check] }) if ($check); return unless(%node_info); + # If we can't start the python agent, exit immediately + my $pid = xCAT::OPENBMC::start_python_agent(); + if (!defined($pid)) { + xCAT::MsgUtils->message("E", { data => ["Failed to start the xCAT Python agent. Check /var/log/xcat/cluster.log for more information."] }, $callback); + return; + } + xCAT::OPENBMC::submit_agent_request($pid, $request, \%node_info, $callback); xCAT::OPENBMC::wait_agent($pid, $callback); }