Fix hardware monitor degrade event handling

Long hostname support introduced a bug that causes the mtcAgent
to reject hardware monitor degrade requests due to the originating
service (daemon) not recognized.

This update fixes the parsed parameters in mtcAgent and adds
a sensor parm to the degrade API so that the sensor name
accompanying the degrade event can be logged in mtcAgent.

Test Plan: for hwmond degrade handling

PASS: verify degrade assert and sensor name in mtcAgent degrade assert log
PASS: Verify degrade clear handling and log

Change-Id: I5c11cc5f679f21e6aadd4d5be25e6c08a241e80b
Closes-Bug: 1838020
Signed-off-by: Eric MacDonald <eric.macdonald@windriver.com>
This commit is contained in:
Eric MacDonald 2019-07-26 09:02:08 -04:00
parent 04e4440d5b
commit aefc81ec91
4 changed files with 15 additions and 8 deletions

View File

@ -1,3 +1,3 @@
SRC_DIR="src"
TIS_PATCH_VER=153
TIS_PATCH_VER=154
BUILD_IS_SLOW=5

View File

@ -5004,7 +5004,10 @@ int nodeLinkClass::collectd_notify_handler ( string & hostname,
* "hwmon" - The Hardware Monitor process
*
**********************************************************************************/
int nodeLinkClass::node_degrade_control ( string & hostname, int state, string service )
int nodeLinkClass::node_degrade_control ( string & hostname,
int state,
string service,
string sensor )
{
int rc = FAIL_UNKNOWN_HOSTNAME ;
@ -5013,7 +5016,7 @@ int nodeLinkClass::node_degrade_control ( string & hostname, int state, string s
{
unsigned int service_flag = 0 ;
/* convert service string to degrade mask flag
/* convert service string to degrade mask flag
* - handle empty string and unsupported service */
if ( service.empty() )
{
@ -5053,7 +5056,10 @@ int nodeLinkClass::node_degrade_control ( string & hostname, int state, string s
{
if (( node_ptr->degrade_mask & service_flag ) == 0 )
{
wlog ("%s degrade 'assert' from '%s'\n", hostname.c_str(), service.c_str() );
wlog ("%s degrade 'assert' from '%s' (%s)\n",
hostname.c_str(),
service.c_str(),
sensor.empty() ? "" : sensor.c_str() );
node_ptr->degrade_mask |= service_flag ;
}
rc = PASS ;

View File

@ -1808,7 +1808,7 @@ public:
/** Hardware Process Monitor Degrade Event handler.
* see implementation for details */
int node_degrade_control ( string & hostname, int state, string service );
int node_degrade_control ( string & hostname, int state, string service, string sensor );
/** Hardware Monitor 'Action' Event method
*

View File

@ -399,7 +399,8 @@ int mtc_service_inbox ( nodeLinkClass * obj_ptr,
{
if ( ( rc1 = jsonUtil_get_key_val(&msg.buf[0], MTC_JSON_SERVICE, service )) == PASS )
{
if (( msg.cmd == MTC_EVENT_HWMON_CLEAR ) ||
if (( msg.cmd == MTC_DEGRADE_RAISE ) ||
( msg.cmd == MTC_EVENT_HWMON_CLEAR ) ||
( msg.cmd == MTC_EVENT_HWMON_MINOR ) ||
( msg.cmd == MTC_EVENT_HWMON_MAJOR ) ||
( msg.cmd == MTC_EVENT_HWMON_CRIT ) ||
@ -529,7 +530,7 @@ int mtc_service_inbox ( nodeLinkClass * obj_ptr,
service.c_str());
obj_ptr->node_degrade_control ( hostname,
MTC_DEGRADE_CLEAR,
service );
service, sensor );
break ;
}
case MTC_EVENT_HWMON_MINOR:
@ -543,7 +544,7 @@ int mtc_service_inbox ( nodeLinkClass * obj_ptr,
sensor.empty() ? "" : sensor.c_str());
obj_ptr->node_degrade_control ( hostname,
MTC_DEGRADE_RAISE,
sensor );
service, sensor );
break ;
}
case MTC_EVENT_HWMON_RESET: