From cc6cb0f217befb1f27f502febf731cd9c9499a14 Mon Sep 17 00:00:00 2001 From: bxuxa Date: Tue, 27 Nov 2018 14:06:12 +0800 Subject: [PATCH] Clear key words for install status update log message (#5618) - detect provisioning when updateing status to installing/netbooting - consistent message format "xcat.updatestatus - ($node): changing status=($status)" (no need to log the time as syslog has the timestamp) --- xCAT-server/lib/xcat/monitoring/monitorctrl.pm | 12 ++++++++---- xCAT-server/sbin/xcatd | 7 ++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/monitoring/monitorctrl.pm b/xCAT-server/lib/xcat/monitoring/monitorctrl.pm index afd38801a..87aa3378d 100644 --- a/xCAT-server/lib/xcat/monitoring/monitorctrl.pm +++ b/xCAT-server/lib/xcat/monitoring/monitorctrl.pm @@ -627,7 +627,7 @@ sub getNodeStatusFromNodesetState { Arguments: status -- a hash pointer of the node status. A key is a status string. The value is an array pointer of nodes that have the same status. - for example: {alive=>["node1", "node1"], unreachable=>["node5","node100"]} + for example: {alive=>["node1", "node2"], unreachable=>["node5","node100"]} force -- 1 force the input values to be set. -- 0 make sure if the input value is the next valid value. Returns: @@ -637,7 +637,7 @@ sub getNodeStatusFromNodesetState { #-------------------------------------------------------------------------------- sub setNodeStatusAttributes { - print "monitorctrl::setNodeStatusAttributes called\n"; + #print "monitorctrl::setNodeStatusAttributes called\n"; my $temp = shift; if ($temp =~ /xCAT_monitoring::monitorctrl/) { $temp = shift; @@ -703,8 +703,12 @@ sub setNodeStatusAttributes { if (@$nodes > 0) { $updates{'status'} = $_; $updates{'statustime'} = $currtime; - my $nodestate = "@$nodes status: $updates{'status'} statustime: $updates{'statustime'}"; - xCAT::MsgUtils->message('S', "$nodestate"); + #my $nodestate = "@$nodes status: $updates{'status'} statustime: $updates{'statustime'}"; + foreach my $node (@$nodes) { + # To make the log clear, iterate for each node. This might be potential performance issue! + my $nodestate = "xcat.updatestatus - $node: changing status=$updates{'status'}"; + xCAT::MsgUtils->message('S', "$nodestate"); + } my $where_clause; my $dbname = xCAT::Utils->get_DBName(); diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 0f55e83c6..71aa7bc75 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -509,7 +509,12 @@ sub do_installm_service { node => [$node], arg => ["$newstat"], ); - xCAT::MsgUtils->trace(0, "I", "xcatd: triggering \'updatenodestat $node $newstat\'..."); + # TODO, better to use constant here for the specified status + if ($newstat eq 'installing') { + xCAT::MsgUtils->trace(0, "I", "xcat.updatestatus - $node: provisioning detected..."); + } elsif ($newstat eq 'netbooting') { + xCAT::MsgUtils->trace(0, "I", "xcat.updatestatus - $node: provisioning detected..."); + } # node should be blocked, race condition may occur otherwise #my $pid=xCAT::Utils->xfork(); #unless ($pid) { # fork off the nodeset and potential slowness