From 502662a8a752a62c650cc1c5d78abc6190a1e964 Mon Sep 17 00:00:00 2001 From: "Kyale, Eliud" Date: Thu, 2 Feb 2023 19:12:00 -0500 Subject: [PATCH] Cleanup mtcAgent error logging during startup - reduced log level in http util to warning - use inservice test handler to ensure state change notification is sent to vim - reduce retry count from 3 to 1 for add_handler state_change vim notification Test plan: PASS - AIO-SX: ansible controller startup (race condition) PASS - AIO-DX: ansible controller startup PASS - AIO-DX: SWACT PASS - AIO-DX: power off restart PASS - AIO-DX: full ISO install PASS - AIO-DX: Lock Host PASS - AIO-DX: Unlock Host PASS - AIO-DX: Fail Host ( by rebooting unlocked-enabled standby controller) Story: 2010533 Task: 47338 Signed-off-by: Kyale, Eliud Change-Id: I7576e2642d33c69a4b355be863bd7183fbb81f45 --- mtce/src/common/nodeClass.cpp | 2 ++ mtce/src/common/nodeClass.h | 2 ++ mtce/src/maintenance/mtcHttpUtil.cpp | 2 +- mtce/src/maintenance/mtcNodeHdlrs.cpp | 38 +++++++++++++++------------ 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/mtce/src/common/nodeClass.cpp b/mtce/src/common/nodeClass.cpp index 657eba20..ae0a50a0 100755 --- a/mtce/src/common/nodeClass.cpp +++ b/mtce/src/common/nodeClass.cpp @@ -564,6 +564,8 @@ nodeLinkClass::node* nodeLinkClass::addNode( string hostname ) ptr->was_dor_recovery_mode= false ; ptr->dor_recovery_time = 0 ; + ptr->vim_notified = false ; + ptr->ar_disabled = false ; ptr->ar_cause = MTC_AR_DISABLE_CAUSE__NONE ; memset (&ptr->ar_count, 0, sizeof(ptr->ar_count)); diff --git a/mtce/src/common/nodeClass.h b/mtce/src/common/nodeClass.h index e69224e7..0bb96dc1 100755 --- a/mtce/src/common/nodeClass.h +++ b/mtce/src/common/nodeClass.h @@ -157,6 +157,8 @@ private: /** set true if the BMC is provisioned */ bool bmc_provisioned ; + /** set true upon first successful vim notification */ + bool vim_notified ; /** general retry counter */ int retries ; diff --git a/mtce/src/maintenance/mtcHttpUtil.cpp b/mtce/src/maintenance/mtcHttpUtil.cpp index 71c30f7d..fb8ae216 100755 --- a/mtce/src/maintenance/mtcHttpUtil.cpp +++ b/mtce/src/maintenance/mtcHttpUtil.cpp @@ -443,7 +443,7 @@ int mtcHttpUtil_status ( libEvent & event ) } case 0: { - elog ("%s connection loss (%s:%d)\n", + wlog ("%s connection loss (%s:%d)\n", event.log_prefix.c_str(), event.ip.c_str(), event.port ); event.status = FAIL_HTTP_ZERO_STATUS ; rc = FAIL_HTTP_ZERO_STATUS ; diff --git a/mtce/src/maintenance/mtcNodeHdlrs.cpp b/mtce/src/maintenance/mtcNodeHdlrs.cpp index bef43b4c..c0315fe0 100755 --- a/mtce/src/maintenance/mtcNodeHdlrs.cpp +++ b/mtce/src/maintenance/mtcNodeHdlrs.cpp @@ -6379,23 +6379,6 @@ int nodeLinkClass::add_handler ( struct nodeLinkClass::node * node_ptr ) } case MTC_ADD__MTC_SERVICES: { - if ( node_ptr->operState == MTC_OPER_STATE__ENABLED ) - { - /* Inform the VIM that this host is enabled */ - mtcVimApi_state_change ( node_ptr, VIM_HOST_ENABLED, 3 ); - } - else - { - if ( node_ptr->availStatus == MTC_AVAIL_STATUS__FAILED ) - { - mtcVimApi_state_change ( node_ptr, VIM_HOST_FAILED, 3 ); - } - else - { - mtcVimApi_state_change ( node_ptr, VIM_HOST_DISABLED, 3 ); - } - } - send_hbs_command ( node_ptr->hostname, MTC_CMD_ADD_HOST ); if ( ( AIO_SYSTEM ) || ( is_worker (node_ptr) == true )) @@ -7941,6 +7924,27 @@ int nodeLinkClass::insv_test_handler ( struct nodeLinkClass::node * node_ptr ) } } + if ( node_ptr->vim_notified == false ) + { + if ( node_ptr->operState == MTC_OPER_STATE__ENABLED ) + { + /* Inform the VIM that this host is enabled */ + mtcVimApi_state_change ( node_ptr, VIM_HOST_ENABLED, 3 ); + } + else + { + if ( node_ptr->availStatus == MTC_AVAIL_STATUS__FAILED ) + { + mtcVimApi_state_change ( node_ptr, VIM_HOST_FAILED, 3 ); + } + else + { + mtcVimApi_state_change ( node_ptr, VIM_HOST_DISABLED, 3 ); + } + } + node_ptr->vim_notified = true ; + } + node_ptr->insv_test_count++ ; insvTestStageChange ( node_ptr, MTC_INSV_TEST__START );