diff --git a/mtce-common/src/common/fitCodes.h b/mtce-common/src/common/fitCodes.h index b09f2f52..71ce8bb0 100644 --- a/mtce-common/src/common/fitCodes.h +++ b/mtce-common/src/common/fitCodes.h @@ -89,7 +89,7 @@ #define FIT_CODE__CORRUPT_TOKEN (1) #define FIT_CODE__ADD_DELETE (2) #define FIT_CODE__STUCK_TASK (3) -#define FIT_CODE__AVOID_N_FAIL_IPMITOOL_REQUEST (4) +#define FIT_CODE__AVOID_N_FAIL_BMC_REQUEST (4) #define FIT_CODE__THREAD_TIMEOUT (5) #define FIT_CODE__THREAD_SEGFAULT (6) #define FIT_CODE__SIGNAL_NOEXIT (7) diff --git a/mtce-common/src/common/ipmiUtil.cpp b/mtce-common/src/common/ipmiUtil.cpp index fa45fb97..146cad9a 100644 --- a/mtce-common/src/common/ipmiUtil.cpp +++ b/mtce-common/src/common/ipmiUtil.cpp @@ -34,51 +34,6 @@ int ipmiUtil_init ( void ) return(PASS); } -/* Create a randomly named password filename */ -void ipmiUtil_create_pw_fn ( thread_info_type * info_ptr, string pw ) -{ - info_ptr->password_file.clear (); - string password_tempfile = IPMITOOL_OUTPUT_DIR ; - password_tempfile.append(".") ; - password_tempfile.append(program_invocation_short_name); - password_tempfile.append("-"); - password_tempfile.append(info_ptr->hostname); - password_tempfile.append("-"); - - info_ptr->pw_file_fd = hostUtil_mktmpfile (info_ptr->hostname, - password_tempfile, - info_ptr->password_file, - pw ); - if ( info_ptr->pw_file_fd <= 0 ) - { - info_ptr->status_string = "failed to get an open temporary password filedesc" ; - info_ptr->status = FAIL_FILE_CREATE ; - info_ptr->password_file.clear(); - } - else - { - /* clean-up */ - if ( info_ptr->pw_file_fd > 0 ) - close(info_ptr->pw_file_fd); - info_ptr->pw_file_fd = 0 ; - } -} - -/* Create the ipmitool output_filename */ -string ipmiUtil_create_data_fn ( string & hostname, string file_suffix ) -{ - /* create the output filename */ - string ipmitool_datafile = IPMITOOL_OUTPUT_DIR ; - ipmitool_datafile.append(program_invocation_short_name); - ipmitool_datafile.append("_"); - ipmitool_datafile.append(hostname); - - /* add the sensor list command */ - ipmitool_datafile.append(file_suffix); - - return ( ipmitool_datafile ); -} - /* Create the ipmi request */ string ipmiUtil_create_request ( string cmd, string & ip, string & un, string & pw, string & out ) { diff --git a/mtce-common/src/common/ipmiUtil.h b/mtce-common/src/common/ipmiUtil.h index 1a788577..7cc9edbc 100644 --- a/mtce-common/src/common/ipmiUtil.h +++ b/mtce-common/src/common/ipmiUtil.h @@ -56,13 +56,6 @@ int ipmiUtil_init ( void ); int ipmiUtil_bmc_info_load ( string hostname, const char * filename, bmc_info_type & mc_info ); -void ipmiUtil_mc_info_init ( bmc_info_type & mc_info ); - -/* Create a randomly named password filename */ -void ipmiUtil_create_pw_fn ( thread_info_type * info_ptr, string pw ); - -/* Create the ipmitool output_filename in info_ptr->password_file */ -string ipmiUtil_create_data_fn ( string & hostname, string file_suffix ); /* Create the ipmi request */ string ipmiUtil_create_request ( string cmd, string & ip, string & un, string & pw, string & out ); diff --git a/mtce/src/common/nodeClass.h b/mtce/src/common/nodeClass.h index 81c57b27..daef8287 100755 --- a/mtce/src/common/nodeClass.h +++ b/mtce/src/common/nodeClass.h @@ -881,7 +881,7 @@ private: * * Name : bmc_command_done * - * Description: This utility frees the ipmitool command thread for next execution. + * Description: This utility frees the bmc command thread for next execution. * *****************************************************************************/ diff --git a/mtce/src/hwmon/Makefile b/mtce/src/hwmon/Makefile index 04172293..7d5be098 100644 --- a/mtce/src/hwmon/Makefile +++ b/mtce/src/hwmon/Makefile @@ -7,7 +7,7 @@ SHELL = /bin/bash SRCS += hwmonUtil.cpp -SRCS += hwmonIpmi.cpp +SRCS += hwmonBmc.cpp SRCS += hwmonModel.cpp SRCS += hwmonGroup.cpp SRCS += hwmonSensor.cpp diff --git a/mtce/src/hwmon/hwmon.h b/mtce/src/hwmon/hwmon.h index 320a60df..cd2ce777 100644 --- a/mtce/src/hwmon/hwmon.h +++ b/mtce/src/hwmon/hwmon.h @@ -52,7 +52,7 @@ using namespace std; #define MAX_HOST_SENSORS (512) // (100) #define MAX_HOST_GROUPS (20) #define MIN_SENSOR_GROUPS (4) -#define MAX_SIZE_SENSOR_MSG_BYTES (4096*4) +#define HWMON_MAX_BMC_DATA_BUF_SIZE (4096*8) // Thermal sensor data need 20KiB at least #define HWMON_DEFAULT_LARGE_INTERVAL (MTC_MINS_15) #define HWMON_DEFAULT_AUDIT_INTERVAL (MTC_MINS_2) #define HWMON_MIN_AUDIT_INTERVAL (10) @@ -230,7 +230,7 @@ typedef struct bool logged ; } action_state_type ; -/* Sensor sample data structure for ipmitool output */ +/* Sensor sample data structure for bmc output */ typedef struct { string name ; /* sensor name */ @@ -255,7 +255,7 @@ typedef struct } sensor_data_type; -/* Control structure for ipmi sensor monitoring +/* Control structure for bmc sensor monitoring * * TODO: The interval is part of the host but * should eventually me moved here. diff --git a/mtce/src/hwmon/hwmonIpmi.cpp b/mtce/src/hwmon/hwmonBmc.cpp similarity index 90% rename from mtce/src/hwmon/hwmonIpmi.cpp rename to mtce/src/hwmon/hwmonBmc.cpp index a9cccc1a..3a1d6c55 100644 --- a/mtce/src/hwmon/hwmonIpmi.cpp +++ b/mtce/src/hwmon/hwmonBmc.cpp @@ -6,7 +6,7 @@ * * * @file - * Wind River Titanium Cloud Hardware Monitor IPMI Sensor Utilities + * StarlingX Cloud Hardware Monitor BMC Sensor Utilities */ #include @@ -17,15 +17,15 @@ #include "nodeUtil.h" /* for ... mtce common utilities */ #include "jsonUtil.h" /* for ... json string parse utilities */ #include "hwmonUtil.h" /* for ... get_severity */ -#include "hwmonIpmi.h" /* for ... this module header */ +#include "hwmonBmc.h" /* for ... this module header */ #include "hwmonHttp.h" /* for ... hwmonHttp_mod_sensor */ #include "hwmonClass.h" /* for ... service class definition */ -#include "hwmonGroup.h" /* for ... ipmi_get_groupenum */ -#include "hwmonThreads.h" /* for ... IPMITOOL_JSON__SENSORS_LABEL */ +#include "hwmonGroup.h" /* for ... bmc_get_groupenum */ +#include "hwmonThreads.h" /* for ... BMC_JSON__SENSORS_LABEL */ #ifdef WANT_CORR_STATUS #define CORR_STATUS_MAX (6) -static const char *_ipmi_status_desc[] = +static const char *_bmc_status_desc[] = { "ok", // all good - ok "nc", // Non-Critical @@ -38,7 +38,7 @@ static const char *_ipmi_status_desc[] = #ifdef WANT_CORR_EXTENDED_STATUS #define CORR_EXTENDED_STATUS_MAX (6) -static const char *_ipmi_status_extended_desc[] = +static const char *_bmc_status_extended_desc[] = { "lnr", // Lower Non-Recoverable "unr", // Upper Non-Recoverable @@ -53,7 +53,7 @@ static const char *_ipmi_status_extended_desc[] = * * Name : sensor_data_init * - * Descrfiption: Initialize an ipmi sample data structure + * Descrfiption: Initialize an bmc sample data structure * *****************************************************************************/ @@ -78,7 +78,7 @@ void sensor_data_init ( sensor_data_type & data ) * * Name : sensor_data_print * - * Descrfiption: Print an ipmi sample data structure + * Descrfiption: Print an bmc sample data structure * *****************************************************************************/ @@ -100,14 +100,14 @@ void sensor_data_print ( const sensor_data_type & data ) /**************************************************************************** * - * Name : ipmi_load_json_sensor + * Name : bmc_load_json_sensor * * Purpose : Load a json formatted sensor data string into the specifie * sensor data element * *****************************************************************************/ -int ipmi_load_json_sensor ( sensor_data_type & sensor_data , string json_sensor_data ) +int bmc_load_json_sensor ( sensor_data_type & sensor_data , string json_sensor_data ) { int rc = FAIL_KEY_VALUE_PARSE ; // ilog ("sensor data:%s\n", json_sensor_data.c_str() ); @@ -261,20 +261,20 @@ bool _handle_dup_sensors ( string hostname, /***************************************************************************** * - * Name : ipmi_load_sensor_samples + * Name : bmc_load_sensor_samples * * Description: Load all the sensor samples into hardware mon. * ****************************************************************************/ -int hwmonHostClass::ipmi_load_sensor_samples ( struct hwmonHostClass::hwmon_host * host_ptr, char * msg_ptr ) +int hwmonHostClass::bmc_load_sensor_samples ( struct hwmonHostClass::hwmon_host * host_ptr, char * msg_ptr ) { int rc ; int samples = 0 ; host_ptr->samples = 0 ; - rc = jsonUtil_array_elements ( msg_ptr, IPMITOOL_JSON__SENSORS_LABEL, samples ) ; + rc = jsonUtil_array_elements ( msg_ptr, BMC_JSON__SENSORS_LABEL, samples ) ; if ( rc == PASS ) { string sensor_data ; @@ -307,10 +307,10 @@ int hwmonHostClass::ipmi_load_sensor_samples ( struct hwmonHostClass::hwmon_host for ( int index = 0 ; index < samples ; index++ ) { sensor_data.clear(); - rc = jsonUtil_get_array_idx ( msg_ptr, IPMITOOL_JSON__SENSORS_LABEL, index, sensor_data ) ; + rc = jsonUtil_get_array_idx ( msg_ptr, BMC_JSON__SENSORS_LABEL, index, sensor_data ) ; if ( rc == PASS ) { - if ( ipmi_load_json_sensor ( host_ptr->sample[host_ptr->samples], sensor_data ) == PASS ) + if ( bmc_load_json_sensor ( host_ptr->sample[host_ptr->samples], sensor_data ) == PASS ) { bool found = false ; @@ -336,7 +336,7 @@ int hwmonHostClass::ipmi_load_sensor_samples ( struct hwmonHostClass::hwmon_host { /* Drop any sensors that don't fall into a valid group */ host_ptr->sample[host_ptr->samples].group_enum = - ipmi_get_groupenum ( host_ptr->hostname, + bmc_get_groupenum ( host_ptr->hostname, host_ptr->sample[host_ptr->samples].unit, host_ptr->sample[host_ptr->samples].name); @@ -372,7 +372,7 @@ int hwmonHostClass::ipmi_load_sensor_samples ( struct hwmonHostClass::hwmon_host else { host_ptr->bmc_thread_info.status_string = "failed to find '" ; - host_ptr->bmc_thread_info.status_string.append(IPMITOOL_JSON__SENSORS_LABEL); + host_ptr->bmc_thread_info.status_string.append(BMC_JSON__SENSORS_LABEL); host_ptr->bmc_thread_info.status_string.append("' label") ; host_ptr->bmc_thread_info.status = FAIL_JSON_PARSE ; } @@ -392,7 +392,7 @@ void _generate_transient_log ( sensor_type * sensor_ptr ) } -int hwmonHostClass::ipmi_update_sensors ( struct hwmonHostClass::hwmon_host * host_ptr ) +int hwmonHostClass::bmc_update_sensors ( struct hwmonHostClass::hwmon_host * host_ptr ) { /* Mark all sensors as not being updated only to get changed below when it is updated. * This allows us to quickly identify what sensors are missing */ @@ -530,7 +530,7 @@ int hwmonHostClass::ipmi_update_sensors ( struct hwmonHostClass::hwmon_host * ho if ( host_ptr->sample[j].status.compare("na") == 0 ) { host_ptr->sensor[i].sample_severity = - get_ipmi_severity (host_ptr->sample[j].status); + get_bmc_severity (host_ptr->sample[j].status); } else if ( host_ptr->sample[j].unit.compare(DISCRETE)) { @@ -538,7 +538,7 @@ int hwmonHostClass::ipmi_update_sensors ( struct hwmonHostClass::hwmon_host * ho /* get severity level */ host_ptr->sensor[i].sample_severity = - get_ipmi_severity (host_ptr->sample[j].status); + get_bmc_severity (host_ptr->sample[j].status); /* Check to see if we need to generate the transient log. * Only generate it if want_debounce_log_if_ok is true and @@ -549,14 +549,14 @@ int hwmonHostClass::ipmi_update_sensors ( struct hwmonHostClass::hwmon_host * ho _generate_transient_log ( &host_ptr->sensor[i] ); } - /* Minor severity from get_ipmi_severity means + /* Minor severity from get_bmc_severity means * that the severity status is unexpected */ if ( host_ptr->sensor[i].sample_severity == HWMON_SEVERITY_MINOR ) { if ( host_ptr->sensor[i].status.compare("minor") == 0 ) { /* only print this log on the first state transition */ - wlog ("%s '%s' unexpected ipmi sensor reading '%s'\n", + wlog ("%s '%s' unexpected bmc sensor reading '%s'\n", host_ptr->hostname.c_str(), host_ptr->sensor[i].sensorname.c_str(), host_ptr->sample[j].status.c_str()); @@ -586,7 +586,7 @@ int hwmonHostClass::ipmi_update_sensors ( struct hwmonHostClass::hwmon_host * ho /* otherwise correlate the status against the sensors we care about */ else { - unsigned short ipmi_status = (unsigned short)strtol((char*)host_ptr->sample[j].status.data(), NULL, 0 ); + unsigned short bmc_status = (unsigned short)strtol((char*)host_ptr->sample[j].status.data(), NULL, 0 ); /* interpret discrete sensor readings for known Quanta discrete * sensors that need to be represented with a correlated status */ @@ -594,14 +594,14 @@ int hwmonHostClass::ipmi_update_sensors ( struct hwmonHostClass::hwmon_host * ho host_ptr->hostname.c_str(), host_ptr->sensor[i].sensorname.c_str(), host_ptr->sample[j].status.c_str(), - ipmi_status ); + bmc_status ); /* treat thermal trip sensors failures as Major. * A good reading is 0x0080 */ if (( host_ptr->sensor[i].sensorname.compare("PCH Thermal Trip") == 0 ) || ( host_ptr->sensor[i].sensorname.compare("MB Thermal Trip") == 0 )) { - if ( ipmi_status == 0x0080 ) + if ( bmc_status == 0x0080 ) { host_ptr->sensor[i].sample_severity = HWMON_SEVERITY_GOOD ; if ( host_ptr->sensor[i].want_debounce_log_if_ok == true ) @@ -616,7 +616,7 @@ int hwmonHostClass::ipmi_update_sensors ( struct hwmonHostClass::hwmon_host * ho } else if ( host_ptr->sensor[i].sensorname.compare("PSU Redundancy") == 0 ) { - if ( ipmi_status == 0x0180 ) /* Fully Redundant */ + if ( bmc_status == 0x0180 ) /* Fully Redundant */ { host_ptr->sensor[i].sample_severity = HWMON_SEVERITY_GOOD ; if ( host_ptr->sensor[i].want_debounce_log_if_ok == true ) @@ -624,7 +624,7 @@ int hwmonHostClass::ipmi_update_sensors ( struct hwmonHostClass::hwmon_host * ho _generate_transient_log ( &host_ptr->sensor[i] ); } } - else if ( ipmi_status == 0x0280 ) /* Redundancy Lost */ + else if ( bmc_status == 0x0280 ) /* Redundancy Lost */ { host_ptr->sensor[i].sample_severity = HWMON_SEVERITY_MAJOR ; } @@ -633,7 +633,7 @@ int hwmonHostClass::ipmi_update_sensors ( struct hwmonHostClass::hwmon_host * ho wlog ("%s '%s' unexpected discrete status reading '0x%04x'\n", host_ptr->hostname.c_str(), host_ptr->sensor[i].sensorname.c_str(), - ipmi_status); + bmc_status); sensor_data_print (host_ptr->sample[j]); blog3 ("%s ... %s\n", host_ptr->hostname.c_str(), host_ptr->bmc_thread_info.data.c_str()); @@ -654,8 +654,8 @@ int hwmonHostClass::ipmi_update_sensors ( struct hwmonHostClass::hwmon_host * ho #define INPUT_OOR_PRESENT (0x2000) /* Presence Detected and ok */ - // if ( ipmi_status == 0x0180 ) - if ( (ipmi_status&STATUS_BIT_MASK) == PRESENCE_DETECTED ) + // if ( bmc_status == 0x0180 ) + if ( (bmc_status&STATUS_BIT_MASK) == PRESENCE_DETECTED ) { host_ptr->sensor[i].sample_severity = HWMON_SEVERITY_GOOD ; if ( host_ptr->sensor[i].want_debounce_log_if_ok == true ) @@ -665,28 +665,28 @@ int hwmonHostClass::ipmi_update_sensors ( struct hwmonHostClass::hwmon_host * ho } /* No Presence Detect */ - // else if (( ipmi_status == 0x0080 ) || ( ipmi_status == 0x0000 )) - else if ( (ipmi_status&STATUS_BIT_MASK) == NO_PRESENCE_DETECTED ) + // else if (( bmc_status == 0x0080 ) || ( bmc_status == 0x0000 )) + else if ( (bmc_status&STATUS_BIT_MASK) == NO_PRESENCE_DETECTED ) { host_ptr->sensor[i].sample_severity = HWMON_SEVERITY_MINOR ; } /* Failure Detected with anything else */ /* 0x02xx */ - else if ( (ipmi_status&STATUS_BIT_MASK) & FAILURE_DETECTED ) + else if ( (bmc_status&STATUS_BIT_MASK) & FAILURE_DETECTED ) { host_ptr->sensor[i].sample_severity = HWMON_SEVERITY_CRITICAL ; } /* Presence Detected & Predictive Failure */ - //else if ( (ipmi_status&STATUS_BIT_MASK) == ( PRESENCE_DETECTED | PREDICTIVE_FAILURE )) + //else if ( (bmc_status&STATUS_BIT_MASK) == ( PRESENCE_DETECTED | PREDICTIVE_FAILURE )) // TODO: Fix this ... - else if ( ( ipmi_status == 0x1580 ) || /* Presence Detected & Predictive Failure & Input Lost Or Out Of Range */ - ( ipmi_status == 0x2580 ) || /* Presence Detected & Predictive Failure & Input Out Of Range */ - ( ipmi_status == 0x3580 ) || /* Presence Detected & Predictive Failure & both of the above */ - ( ipmi_status == 0x0580 ) || /* Presence Detected & Predictive Failure */ - ( ipmi_status == 0x0980 ) || /* Presence Detected & Power Supply Input Lost */ - ( ipmi_status == 0x0d80 ) ) /* Presence Detected & Power Supply Input Out Of Range */ + else if ( ( bmc_status == 0x1580 ) || /* Presence Detected & Predictive Failure & Input Lost Or Out Of Range */ + ( bmc_status == 0x2580 ) || /* Presence Detected & Predictive Failure & Input Out Of Range */ + ( bmc_status == 0x3580 ) || /* Presence Detected & Predictive Failure & both of the above */ + ( bmc_status == 0x0580 ) || /* Presence Detected & Predictive Failure */ + ( bmc_status == 0x0980 ) || /* Presence Detected & Power Supply Input Lost */ + ( bmc_status == 0x0d80 ) ) /* Presence Detected & Power Supply Input Out Of Range */ { host_ptr->sensor[i].sample_severity = HWMON_SEVERITY_MAJOR ; } @@ -696,7 +696,7 @@ int hwmonHostClass::ipmi_update_sensors ( struct hwmonHostClass::hwmon_host * ho wlog ("%s '%s' unexpected discrete status reading '0x%04x'\n", host_ptr->hostname.c_str(), host_ptr->sensor[i].sensorname.c_str(), - ipmi_status); + bmc_status); sensor_data_print (host_ptr->sample[j]); blog3 ("%s ... %s\n", host_ptr->hostname.c_str(), host_ptr->bmc_thread_info.data.c_str()); diff --git a/mtce/src/hwmon/hwmonIpmi.h b/mtce/src/hwmon/hwmonBmc.h similarity index 88% rename from mtce/src/hwmon/hwmonIpmi.h rename to mtce/src/hwmon/hwmonBmc.h index a1bf6e4b..df84e522 100644 --- a/mtce/src/hwmon/hwmonIpmi.h +++ b/mtce/src/hwmon/hwmonBmc.h @@ -1,5 +1,5 @@ -#ifndef __INCLUDE_HWMONIPMI_H__ -#define __INCLUDE_HWMONIPMI_H__ +#ifndef __INCLUDE_HWMONBMC_H__ +#define __INCLUDE_HWMONBMC_H__ /* * Copyright (c) 2015-2017 Wind River Systems, Inc. @@ -10,7 +10,7 @@ /** * @file - * Wind River Titanium Cloud's Hardware Monitor "IPMI Sensor" Header + * StarlingX Cloud's Hardware Monitor "BMC Sensor" Header */ #include "hwmon.h" /* for ... sensor_data_type */ @@ -44,6 +44,6 @@ void sensor_data_init ( sensor_data_type & data ); void sensor_data_print ( const sensor_data_type & data ); void sensor_data_copy ( sensor_data_type & from, sensor_data_type & to ); -int ipmi_load_json_sensor ( sensor_data_type & sensor_data , string json_sensor_data ); +int bmc_load_json_sensor ( sensor_data_type & sensor_data , string json_sensor_data ); #endif diff --git a/mtce/src/hwmon/hwmonClass.cpp b/mtce/src/hwmon/hwmonClass.cpp index dbeff8c6..22bff632 100644 --- a/mtce/src/hwmon/hwmonClass.cpp +++ b/mtce/src/hwmon/hwmonClass.cpp @@ -10,7 +10,7 @@ #include "secretUtil.h" #include "hwmonClass.h" #include "hwmonUtil.h" -#include "hwmonIpmi.h" +#include "hwmonBmc.h" #include "hwmonHttp.h" #include "hwmonAlarm.h" #include "hwmonGroup.h" @@ -77,8 +77,8 @@ int hwmonHostClass::addStageChange ( struct hwmonHostClass::hwmon_host * ptr, } } -/* Initialize bmc data for ipmi mode monitoring */ -void hwmonHostClass::ipmi_bmc_data_init ( struct hwmonHostClass::hwmon_host * host_ptr ) +/* Initialize bmc data for bmc mode monitoring */ +void hwmonHostClass::bmc_data_init ( struct hwmonHostClass::hwmon_host * host_ptr ) { host_ptr->ping_info.timer_handler = &hwmonTimer_handler ; host_ptr->accessible = false; @@ -514,7 +514,7 @@ int hwmonHostClass::set_bm_prov ( struct hwmonHostClass::hwmon_host * host_ptr, host_ptr->ping_info.stage = PINGUTIL_MONITOR_STAGE__OPEN ; host_ptr->ping_info.ip = host_ptr->bm_ip ; host_ptr->ping_info.hostname = host_ptr->hostname ; - ipmi_bmc_data_init ( host_ptr ); + bmc_data_init ( host_ptr ); string host_uuid = hostBase.get_uuid( host_ptr->hostname ); barbicanSecret_type * secret = secretUtil_find_secret( host_uuid ); @@ -536,7 +536,7 @@ int hwmonHostClass::set_bm_prov ( struct hwmonHostClass::hwmon_host * host_ptr, ilog ("%s board management controller is being deprovisioned\n", host_ptr->hostname.c_str()); clear_bm_assertions ( host_ptr ); pingUtil_fini ( host_ptr->ping_info ); - ipmi_bmc_data_init ( host_ptr ); + bmc_data_init ( host_ptr ); } host_ptr->bm_provisioned = state ; } @@ -615,8 +615,8 @@ int hwmonHostClass::mod_host ( node_inv_type & inv ) if (( hostUtil_is_valid_bm_type (host_ptr->bm_type) == true ) && ( host_ptr->bm_un.compare(NONE))) { - ipmi_set_group_state ( host_ptr, "disabled" ); - ipmi_disable_sensors ( host_ptr ); + bmc_set_group_state ( host_ptr, "disabled" ); + bmc_disable_sensors ( host_ptr ); } rc = set_bm_prov ( host_ptr, false ); } @@ -704,7 +704,7 @@ int hwmonHostClass::add_host ( node_inv_type & inv ) host_ptr->quanta_server= false ; - ipmi_bmc_data_init ( host_ptr ); + bmc_data_init ( host_ptr ); /* Default audit interval to zero - disable sensor monitoring by default */ host_ptr->interval = 0 ; @@ -716,7 +716,7 @@ int hwmonHostClass::add_host ( node_inv_type & inv ) /* Additions for sensor monitoring using IPMI protocol */ host_ptr->want_degrade_audit = false ; host_ptr->degrade_audit_log_throttle = 0 ; - host_ptr->json_ipmi_sensors.clear(); + host_ptr->json_bmc_sensors.clear(); /* Sensor Monitoring Control Structure */ host_ptr->monitor_ctrl.stage = HWMON_SENSOR_MONITOR__START ; @@ -729,7 +729,6 @@ int hwmonHostClass::add_host ( node_inv_type & inv ) host_ptr->thread_extra_info.bm_ip = host_ptr->bm_ip ; host_ptr->thread_extra_info.bm_un = host_ptr->bm_un ; host_ptr->thread_extra_info.bm_pw.clear() ; - host_ptr->thread_extra_info.sensor_query_request = IPMITOOL_PATH_AND_FILENAME ; /* Sensor Monitoring Thread Initialization */ thread_init ( host_ptr->bmc_thread_ctrl, @@ -912,12 +911,12 @@ int hwmonHostClass::mon_host ( string hostname, bool monitor ) if ( monitor == false ) { /* sets all groups state to disable if monitor is false ; handle state change failure alarming internally */ - rc = ipmi_set_group_state ( hwmon_host_ptr, "disabled" ); + rc = bmc_set_group_state ( hwmon_host_ptr, "disabled" ); } else if ( hwmon_host_ptr->group[0].group_state.compare("disabled") == 0 ) { /* or to enabled if presently disabled - don't change from failed to enabled over a monitor start */ - rc = ipmi_set_group_state ( hwmon_host_ptr, "enabled" ); + rc = bmc_set_group_state ( hwmon_host_ptr, "enabled" ); } } } @@ -1633,7 +1632,7 @@ void hwmonHostClass::restore_group_actions ( struct hwmonHostClass::hwmon_host * /***************************************************************************** * - * Name : ipmi_sensor_model_learn + * Name : bmc_learn_sensor_model * * Description: Setup hwmon for a sesor model relearn. * Relearn is a background operation. @@ -1641,7 +1640,7 @@ void hwmonHostClass::restore_group_actions ( struct hwmonHostClass::hwmon_host * * *****************************************************************************/ -int hwmonHostClass::ipmi_learn_sensor_model ( string uuid ) +int hwmonHostClass::bmc_learn_sensor_model ( string uuid ) { /* check for empty list condition */ if ( hwmon_head == NULL ) @@ -2136,7 +2135,7 @@ void hwmonHostClass::audit_interval_change ( string hostname ) * monitoring audit interval for this host has changed. * * The actual interval change is handled in the DELAY stage of the - * ipmi_sensor_monitor. + * bmc_sensor_monitor. * * This API is called by http group modify handler to trigger * change of the sensor audit interval to a specific value. @@ -2171,11 +2170,11 @@ void hwmonHostClass::log_sensor_data ( struct hwmonHostClass::hwmon_host * host_ { string sensor_datafile = IPMITOOL_OUTPUT_DIR ; sensor_datafile.append(host_ptr->hostname); - sensor_datafile.append(IPMITOOL_SENSOR_OUTPUT_FILE_SUFFIX); + sensor_datafile.append(BMC_SENSOR_OUTPUT_FILE_SUFFIX); string debugfile = "/tmp/" ; debugfile.append(host_ptr->hostname); - debugfile.append(IPMITOOL_SENSOR_OUTPUT_FILE_SUFFIX); + debugfile.append(BMC_SENSOR_OUTPUT_FILE_SUFFIX); debugfile.append("_debug"); string source = pt() ; @@ -2212,11 +2211,10 @@ void hwmonHostClass::mem_log_info ( struct hwmonHostClass::hwmon_host * hwmon_ho void hwmonHostClass::mem_log_options ( struct hwmonHostClass::hwmon_host * hwmon_host_ptr ) { char str[MAX_MEM_LOG_DATA] ; - snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\tMonitoring: %s Provisioned: %s Connected: %s Count: %d\n", + snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\tMonitoring: %s Provisioned: %s Count: %d\n", hwmon_host_ptr->hostname.c_str(), hwmon_host_ptr->monitor ? "YES" : "no" , hwmon_host_ptr->bm_provisioned ? "YES" : "no", - hwmon_host_ptr->connected ? "YES" : "no", hwmon_host_ptr->sensor_query_count); mem_log (str); diff --git a/mtce/src/hwmon/hwmonClass.h b/mtce/src/hwmon/hwmonClass.h index ba75a862..5c4ddd19 100644 --- a/mtce/src/hwmon/hwmonClass.h +++ b/mtce/src/hwmon/hwmonClass.h @@ -19,8 +19,6 @@ #include "hwmonSensor.h" #include "bmcUtil.h" /* for ... board mgmnt utility header */ -//#include "hwmonIpmi.h" /* for ... sensor_data_type */ - typedef enum { HWMON_DEL__START = 0, @@ -55,16 +53,7 @@ class hwmonHostClass libEvent secretEvent ; - /** set true once a connection is estabished and - * set false when error recovery is performed on the connection - **/ - bool connected ; - - /** 'Connected' alternative (see above) for ipmi sensor monitoring. - * We don't 'connect' using ipmi sensor monitoring so a more - * representative word is introduced. - * - * The BMC is 'accessible' once provisioning data is available + /** The BMC is 'accessible' once provisioning data is available * and bmc is verified pingable. **/ bool accessible; @@ -125,7 +114,7 @@ class hwmonHostClass /* Sensor Monitoring Thread Structs */ - /* the info required by the sensor read thread to issue a ipmitool + /* the info required by the sensor read thread to issue a bmc * lanplus request to read sensors over the network */ thread_ctrl_type bmc_thread_ctrl ; /* control data used to manage the thread */ thread_info_type bmc_thread_info ; /* thread info used to execute and post results */ @@ -140,7 +129,7 @@ class hwmonHostClass int want_degrade_audit ; /* the last json string containing the last read sensor data */ - string json_ipmi_sensors ; + string json_bmc_sensors ; int sensors ; /**< # of sensors in the sysinv database */ int samples ; /**< # of parsed samples from the reader thread */ @@ -306,7 +295,7 @@ class hwmonHostClass * *************************************************************************/ - void ipmi_bmc_data_init ( struct hwmonHostClass::hwmon_host * host_ptr ); + void bmc_data_init ( struct hwmonHostClass::hwmon_host * host_ptr ); /*************************************************************************** * @@ -316,43 +305,43 @@ class hwmonHostClass * * Implemented in hwmonModel.cpp * - * ipmi_load_sensor_model - will load an existing sensor and group + * bmc_load_sensor_model - will load an existing sensor and group * model from the database for the specified * host into hwmond. * - * ipmi_create_sensor_model - will create a new sensor and group model in + * bmc_create_sensor_model - will create a new sensor and group model in * the sysinv database for the specified host. * - * ipmi_delete_sensor_model - will delete the sensor and group model from + * bmc_delete_sensor_model - will delete the sensor and group model from * the sysinv database for the specified host. * - * ipmi_create_sample_model - will create a sensor model based on sample + * bmc_create_sample_model - will create a sensor model based on sample * data for the specified host. * - * ipmi_create_quanta_model - will create a quanta server sensor group model + * bmc_create_quanta_model - will create a quanta server sensor group model * for the specified host from sensor sample data. * *************************************************************************/ - int ipmi_load_sensor_model ( struct hwmonHostClass::hwmon_host * host_ptr ); - int ipmi_create_sensor_model ( struct hwmonHostClass::hwmon_host * host_ptr ); - int ipmi_delete_sensor_model ( struct hwmonHostClass::hwmon_host * host_ptr ); - int ipmi_create_sample_model ( struct hwmonHostClass::hwmon_host * host_ptr ); - int ipmi_create_quanta_model ( struct hwmonHostClass::hwmon_host * host_ptr ); + int bmc_load_sensor_model ( struct hwmonHostClass::hwmon_host * host_ptr ); + int bmc_create_sensor_model ( struct hwmonHostClass::hwmon_host * host_ptr ); + int bmc_delete_sensor_model ( struct hwmonHostClass::hwmon_host * host_ptr ); + int bmc_create_sample_model ( struct hwmonHostClass::hwmon_host * host_ptr ); + int bmc_create_quanta_model ( struct hwmonHostClass::hwmon_host * host_ptr ); /************************************************************************* * * The following are sensor sample sensor data management APIs * - * File: hwmonIpmi.cpp + * File: hwmonBmc.cpp * - * ipmi_load_sensor_samples - loads the samples into the sample list. + * bmc_load_sensor_samples - loads the samples into the sample list. * - * ipmi_update_sensors - updates the hwmond with the latest sensor + * bmc_update_sensors - updates the hwmond with the latest sensor * sample severity level for the specified host. * *************************************************************************/ - int ipmi_load_sensor_samples ( struct hwmonHostClass::hwmon_host * host_ptr, char * msg_ptr ); - int ipmi_update_sensors ( struct hwmonHostClass::hwmon_host * host_ptr ); + int bmc_load_sensor_samples ( struct hwmonHostClass::hwmon_host * host_ptr, char * msg_ptr ); + int bmc_update_sensors ( struct hwmonHostClass::hwmon_host * host_ptr ); /************************************************************************** * @@ -364,14 +353,14 @@ class hwmonHostClass * * This code that was taken from the add_handler and put into this stand * alone procedure for code re-use so that it can be called by the add - * handler for ipmi without cloning it. + * handler for bmc without cloning it. * **************************************************************************/ bool manage_startup_states ( struct hwmonHostClass::hwmon_host * host_ptr ); /************************************************************************** * - * Handle ipmitool monitoring audit interval changes where there is one + * Handle bmc monitoring audit interval changes where there is one * interval for all sensor groups. Changing a single group's audit * interval does so for all. All for 1 and one for all. * @@ -379,7 +368,7 @@ class hwmonHostClass int interval_change_handler( struct hwmonHostClass::hwmon_host * host_ptr ); /* The sensor monitor FSM */ - int ipmi_sensor_monitor ( struct hwmonHostClass::hwmon_host * host_ptr ); + int bmc_sensor_monitor ( struct hwmonHostClass::hwmon_host * host_ptr ); /* Remove all groups / sensor from hwmon */ int hwmon_del_groups ( struct hwmonHostClass::hwmon_host * host_ptr ); @@ -392,35 +381,35 @@ class hwmonHostClass * and manage sensr group alarms. Since state changes affect alarming * the two functions work well together. ***************************************************************************/ - int ipmi_set_group_state ( struct hwmonHostClass::hwmon_host * host_ptr, string state ); + int bmc_set_group_state ( struct hwmonHostClass::hwmon_host * host_ptr, string state ); /* Set all sensors to disabled-offline state/status */ - int ipmi_disable_sensors ( struct hwmonHostClass::hwmon_host * host_ptr ); + int bmc_disable_sensors ( struct hwmonHostClass::hwmon_host * host_ptr ); /**************************************************************************** - * Create sensor groups in hwmon based on sample data using similar ipmi + * Create sensor groups in hwmon based on sample data using similar bmc * unit type canned groups and save those groups into the database. ****************************************************************************/ - int ipmi_create_groups ( struct hwmonHostClass::hwmon_host * host_ptr ); + int bmc_create_groups ( struct hwmonHostClass::hwmon_host * host_ptr ); /**************************************************************************** * Load the sensor samples into hwmon and then save them into the database. ****************************************************************************/ - int ipmi_create_sensors ( struct hwmonHostClass::hwmon_host * host_ptr ); + int bmc_create_sensors ( struct hwmonHostClass::hwmon_host * host_ptr ); /***************************************************************************** * Add a new group to hwmon and then to the sysinv database. ****************************************************************************/ - int ipmi_add_group ( struct hwmonHostClass::hwmon_host * host_ptr , + int bmc_add_group ( struct hwmonHostClass::hwmon_host * host_ptr , string datatype, string sensortype, canned_group_enum grouptype, string group_name, string path ); /**************************************************************************** - * Put the current ipmi sensor list into the previously created sensor type + * Put the current bmc sensor list into the previously created sensor type * based groups and save that grouping in the sysinv database. *****************************************************************************/ - int ipmi_group_sensors ( struct hwmonHostClass::hwmon_host * host_ptr ); + int bmc_group_sensors ( struct hwmonHostClass::hwmon_host * host_ptr ); /*************************************************************************** * Check whether the group/sensor accounting looks valid. @@ -506,7 +495,7 @@ class hwmonHostClass int mon_host ( string hostname, bool monitor ); int request_del_host ( string hostname ); - int ipmi_learn_sensor_model ( string uuid ); + int bmc_learn_sensor_model ( string uuid ); /**************************************************************************** * diff --git a/mtce/src/hwmon/hwmonFsm.cpp b/mtce/src/hwmon/hwmonFsm.cpp index f7365a81..e5e7734b 100644 --- a/mtce/src/hwmon/hwmonFsm.cpp +++ b/mtce/src/hwmon/hwmonFsm.cpp @@ -15,7 +15,7 @@ #include "hwmonClass.h" #include "hwmonHttp.h" #include "hwmonSensor.h" -#include "hwmonThreads.h" /* for ... ipmitool_thread */ +#include "hwmonThreads.h" /* for ... bmc_thread */ #include "secretUtil.h" @@ -57,7 +57,7 @@ void hwmonHostClass::hwmon_fsm ( void ) host_ptr = getHost ( hostname ); if ( host_ptr ) { - /* Handle host delete in ipmi mode + /* Handle host delete in bmc mode * * Note: the bmc may have been deprovisioned already * so the delete needs to be deleted up front. @@ -89,7 +89,7 @@ void hwmonHostClass::hwmon_fsm ( void ) { /* * Monitor and Manage active threads - * The ipmitool thread needs to run to learn the sensors + * The bmc thread needs to run to learn the sensors * to begin with as well as continually monitor them */ thread_handler ( host_ptr->bmc_thread_ctrl, host_ptr->bmc_thread_info ); @@ -119,13 +119,13 @@ void hwmonHostClass::hwmon_fsm ( void ) if (( host_ptr->accessible == false ) && ( host_ptr->ping_info.ok == true )) { ilog ("%s bmc is accessible\n", host_ptr->hostname.c_str()); - host_ptr->accessible = host_ptr->connected = true ; + host_ptr->accessible = true ; } else if (( host_ptr->accessible == true ) && ( host_ptr->ping_info.ok == false )) { wlog ("%s bmc access lost\n", host_ptr->hostname.c_str()); thread_kill ( host_ptr->bmc_thread_ctrl, host_ptr->bmc_thread_info ); - host_ptr->accessible = host_ptr->connected = false ; + host_ptr->accessible = false ; host_ptr->sensor_query_count = 0 ; host_ptr->bmc_fw_version.clear(); host_ptr->ping_info.stage = PINGUTIL_MONITOR_STAGE__FAIL ; @@ -172,7 +172,7 @@ void hwmonHostClass::hwmon_fsm ( void ) else if ( host_ptr->accessible ) { /* typical success path */ - hwmonHostClass::ipmi_sensor_monitor ( host_ptr ); + hwmonHostClass::bmc_sensor_monitor ( host_ptr ); } else if ( !thread_idle( host_ptr->bmc_thread_ctrl ) ) { diff --git a/mtce/src/hwmon/hwmonGroup.cpp b/mtce/src/hwmon/hwmonGroup.cpp index 32f1e0de..3d26a755 100644 --- a/mtce/src/hwmon/hwmonGroup.cpp +++ b/mtce/src/hwmon/hwmonGroup.cpp @@ -28,10 +28,10 @@ */ -/* IPMI Sensor Types +/* BMC Sensor Types * Each Sensor group gets a unique name from this list * - * Is taken from ipmitool private file + * Is taken from bmc private file */ static const char * canned_group__null = @@ -98,7 +98,7 @@ static const char * canned_group__misc = #endif -/* Other types from ipmitool source ******** +/* Other types from bmc source ******** "VA", "Nits", @@ -226,18 +226,18 @@ void groupSensors_print ( sensor_group_type * group_ptr ) /***************************************************************************** * - * Name : ipmi_get_grouptype + * Name : bmc_get_grouptype * * Description: returns the group type ; which is really a baseline - * ipmi 'sensor type'. + * bmc 'sensor type'. * *****************************************************************************/ -string ipmi_get_grouptype ( string & hostname, +string bmc_get_grouptype ( string & hostname, string & unittype, string & sensorname) { - canned_group_enum group_enum = ipmi_get_groupenum (hostname, + canned_group_enum group_enum = bmc_get_groupenum (hostname, unittype, sensorname); if (( group_enum < HWMON_CANNED_GROUPS ) && @@ -253,14 +253,14 @@ string ipmi_get_grouptype ( string & hostname, /***************************************************************************** * - * Name : ipmi_get_groupenum + * Name : bmc_get_groupenum * * Description: Returns the group enum that the specified unit would * fall into. * *****************************************************************************/ -canned_group_enum ipmi_get_groupenum ( string & hostname, +canned_group_enum bmc_get_groupenum ( string & hostname, string & unittype, string & sensorname ) { @@ -362,13 +362,13 @@ canned_group_enum ipmi_get_groupenum ( string & hostname, /***************************************************************************** * - * Name : ipmi_get_groupname + * Name : bmc_get_groupname * * Description: returns the group name for the specified group enum. * *****************************************************************************/ -string ipmi_get_groupname ( canned_group_enum group_enum ) +string bmc_get_groupname ( canned_group_enum group_enum ) { if ( group_enum < HWMON_CANNED_GROUPS ) { @@ -405,7 +405,7 @@ void _log_group_add_status ( string hostname, /******************************************************************************** * - * Name : ipmi_add_group + * Name : bmc_add_group * * Purpose : Add a new group to hwmon and then to the sysinv database. * @@ -417,7 +417,7 @@ void _log_group_add_status ( string hostname, * ****************************************************************************/ -int hwmonHostClass::ipmi_add_group ( struct hwmonHostClass::hwmon_host * host_ptr , +int hwmonHostClass::bmc_add_group ( struct hwmonHostClass::hwmon_host * host_ptr , string datatype, string sensortype, canned_group_enum group_enum, @@ -452,14 +452,14 @@ int hwmonHostClass::ipmi_add_group ( struct hwmonHostClass::hwmon_host * host_pt /***************************************************************************** * - * Name : ipmi_create_groups + * Name : bmc_create_groups * * Description: Perform sensor grouping from sample data. - * This is done using similar ipmi unit types from canned groups. + * This is done using similar bmc unit types from canned groups. * *****************************************************************************/ -int hwmonHostClass::ipmi_create_groups ( struct hwmonHostClass::hwmon_host * host_ptr ) +int hwmonHostClass::bmc_create_groups ( struct hwmonHostClass::hwmon_host * host_ptr ) { int rc = PASS ; int sample_errors = 0 ; @@ -506,7 +506,7 @@ int hwmonHostClass::ipmi_create_groups ( struct hwmonHostClass::hwmon_host * hos } /* get the group enum from the sensor type and name */ - canned_group_index = ipmi_get_groupenum ( host_ptr->hostname, + canned_group_index = bmc_get_groupenum ( host_ptr->hostname, host_ptr->sample[s].unit, host_ptr->sample[s].name ); @@ -597,14 +597,14 @@ int hwmonHostClass::ipmi_create_groups ( struct hwmonHostClass::hwmon_host * hos /**************************************************************************** * - * Name : ipmi_group_sensors + * Name : bmc_group_sensors * * Description: Group the sensors based on the group enum that was assigned * to the sensor during group creation. * *****************************************************************************/ -int hwmonHostClass::ipmi_group_sensors ( struct hwmonHostClass::hwmon_host * host_ptr ) +int hwmonHostClass::bmc_group_sensors ( struct hwmonHostClass::hwmon_host * host_ptr ) { int rc = FAIL ; int grouping_errors = 0 ; @@ -695,9 +695,9 @@ int hwmonHostClass::ipmi_group_sensors ( struct hwmonHostClass::hwmon_host * hos /***************************************************************************** * - * Name : ipmi_set_group_state + * Name : bmc_set_group_state * - * Purpose : With the introduction of ipmi monitoring, all groups are + * Purpose : With the introduction of bmc monitoring, all groups are * monitored at once. Therefore all should be in the same state. * * Description: Set all groups to specified state @@ -708,7 +708,7 @@ int hwmonHostClass::ipmi_group_sensors ( struct hwmonHostClass::hwmon_host * hos * ******************************************************************************/ -int hwmonHostClass::ipmi_set_group_state ( struct hwmonHostClass::hwmon_host * host_ptr , string state ) +int hwmonHostClass::bmc_set_group_state ( struct hwmonHostClass::hwmon_host * host_ptr , string state ) { int rc = FAIL_NULL_POINTER ; if ( host_ptr ) diff --git a/mtce/src/hwmon/hwmonGroup.h b/mtce/src/hwmon/hwmonGroup.h index ef6c52ab..f8b20aaa 100644 --- a/mtce/src/hwmon/hwmonGroup.h +++ b/mtce/src/hwmon/hwmonGroup.h @@ -32,13 +32,13 @@ void groupSensors_print ( sensor_group_type * group_ptr ); -string ipmi_get_groupname ( canned_group_enum group_enum ); +string bmc_get_groupname ( canned_group_enum group_enum ); -string ipmi_get_grouptype ( string & hostname, +string bmc_get_grouptype ( string & hostname, string & unittype, string & sensorname); -canned_group_enum ipmi_get_groupenum ( string & hostname, +canned_group_enum bmc_get_groupenum ( string & hostname, string & unittype, string & sensorname ); diff --git a/mtce/src/hwmon/hwmonHdlr.cpp b/mtce/src/hwmon/hwmonHdlr.cpp index 8e68a9ed..741235fd 100644 --- a/mtce/src/hwmon/hwmonHdlr.cpp +++ b/mtce/src/hwmon/hwmonHdlr.cpp @@ -24,7 +24,7 @@ #include "hwmonSensor.h" /* for ... this mpodule header */ #include "hwmonHttp.h" /* for ... hwmonHttp_mod_group */ #include "hwmonAlarm.h" /* for ... hwmonAlarm_major */ -#include "hwmonIpmi.h" /* for ... QUANTA_SAMPLE_PROFILE_.. */ +#include "hwmonBmc.h" /* for ... QUANTA_SAMPLE_PROFILE_.. */ /* Declare the Hardware Monitor Inventory Object */ hwmonHostClass hostInv ; @@ -400,7 +400,7 @@ int hwmonHostClass::add_host_handler ( struct hwmonHostClass::hwmon_host * host_ case HWMON_ADD__START: { /* force load of sensors from database if sensors = 0 and they exist */ - int rc = hwmonHostClass::ipmi_load_sensor_model ( host_ptr ) ; + int rc = hwmonHostClass::bmc_load_sensor_model ( host_ptr ) ; if ( rc == PASS ) { mtcTimer_start ( host_ptr->addTimer, hwmonTimer_handler, 1); @@ -410,7 +410,7 @@ int hwmonHostClass::add_host_handler ( struct hwmonHostClass::hwmon_host * host_ { /* there might be issue accessing the sysinv database */ int delay = (rand()%30)+1 ; - wlog ("%s ipmi_load_sensor_model failed (rc:%d) ; retrying in %d secs\n", host_ptr->hostname.c_str(), rc , delay); + wlog ("%s bmc_load_sensor_model failed (rc:%d) ; retrying in %d secs\n", host_ptr->hostname.c_str(), rc , delay); mtcTimer_start ( host_ptr->addTimer, hwmonTimer_handler, delay ); addStageChange ( host_ptr , HWMON_ADD__WAIT ); } @@ -559,11 +559,11 @@ int hwmonHostClass::interval_change_handler ( struct hwmonHostClass::hwmon_host /* only updat the group if they differ */ if ( host_ptr->group[g].group_interval != host_ptr->interval ) { - /* update the group interval. Even though ipmi + /* update the group interval. Even though bmc * montoring does not need it, we need to be * backwards compatible. * - * ipmi monitors all groups at the same interval */ + * bmc monitors all groups at the same interval */ int old = host_ptr->group[g].group_interval ; host_ptr->group[g].group_interval = host_ptr->interval ; @@ -630,7 +630,7 @@ int hwmonHostClass::interval_change_handler ( struct hwmonHostClass::hwmon_host * * * */ -int hwmonHostClass::ipmi_sensor_monitor ( struct hwmonHostClass::hwmon_host * host_ptr ) +int hwmonHostClass::bmc_sensor_monitor ( struct hwmonHostClass::hwmon_host * host_ptr ) { int rc = RETRY ; @@ -672,7 +672,7 @@ int hwmonHostClass::ipmi_sensor_monitor ( struct hwmonHostClass::hwmon_host * ho ilog ("%s handling sensor model relearn request\n", host_ptr->hostname.c_str()); - rc = ipmi_delete_sensor_model ( host_ptr ); + rc = bmc_delete_sensor_model ( host_ptr ); if ( rc != PASS ) { elog ("%s delete model failure ; retry in %d seconds\n", @@ -1044,7 +1044,7 @@ int hwmonHostClass::ipmi_sensor_monitor ( struct hwmonHostClass::hwmon_host * ho /****************************************************************** * - * The READ stage requests the launch of the hwmonThread_ipmitool + * The READ stage requests the launch of the hwmonThread_bmc * thread that will read the sensor data from the specified host. * * An umbrella timeout timer is started on behalf of the PARSE @@ -1119,7 +1119,7 @@ int hwmonHostClass::ipmi_sensor_monitor ( struct hwmonHostClass::hwmon_host * ho /****************************************************************** * The PARSE stage has 2 main functions * - * 1. Wait for the ipmitool command completion from the READ stage + * 1. Wait for the bmc command completion from the READ stage * while monitoring for and handling the unbrella timeout case. * * 2. PARSE the sensor data json string into the sample list @@ -1244,15 +1244,15 @@ int hwmonHostClass::ipmi_sensor_monitor ( struct hwmonHostClass::hwmon_host * ho struct json_object * raw_obj = json_tokener_parse( host_ptr->bmc_thread_info.data.data() ); if ( raw_obj ) { - /* Look for ... IPMITOOL_JSON__SENSOR_DATA_MESSAGE_HEADER */ - status = json_object_object_get_ex ( raw_obj, IPMITOOL_JSON__SENSOR_DATA_MESSAGE_HEADER, &req_obj ); + /* Look for ... BMC_JSON__SENSOR_DATA_MESSAGE_HEADER */ + status = json_object_object_get_ex ( raw_obj, BMC_JSON__SENSOR_DATA_MESSAGE_HEADER, &req_obj ); if (( status == TRUE ) && req_obj ) { char * msg_ptr = (char*)json_object_to_json_string(req_obj) ; - host_ptr->json_ipmi_sensors = msg_ptr ; + host_ptr->json_bmc_sensors = msg_ptr ; if ( msg_ptr ) { - host_ptr->bmc_thread_info.status = ipmi_load_sensor_samples ( host_ptr , msg_ptr); + host_ptr->bmc_thread_info.status = bmc_load_sensor_samples ( host_ptr , msg_ptr); if ( host_ptr->bmc_thread_info.status == PASS ) { if ( host_ptr->samples != host_ptr->sensors ) @@ -1282,14 +1282,14 @@ int hwmonHostClass::ipmi_sensor_monitor ( struct hwmonHostClass::hwmon_host * ho else { host_ptr->bmc_thread_info.status_string = "failed to find '" ; - host_ptr->bmc_thread_info.status_string.append(IPMITOOL_JSON__SENSOR_DATA_MESSAGE_HEADER); + host_ptr->bmc_thread_info.status_string.append(BMC_JSON__SENSOR_DATA_MESSAGE_HEADER); host_ptr->bmc_thread_info.status_string.append("' label") ; host_ptr->bmc_thread_info.status = FAIL_JSON_PARSE ; } } else { - host_ptr->bmc_thread_info.status_string = "failed to parse ipmitool sensor data string" ; + host_ptr->bmc_thread_info.status_string = "failed to parse bmc sensor data string" ; host_ptr->bmc_thread_info.status = FAIL_JSON_PARSE ; } @@ -1310,7 +1310,7 @@ int hwmonHostClass::ipmi_sensor_monitor ( struct hwmonHostClass::hwmon_host * ho } else { - ipmi_set_group_state ( host_ptr, "failed" ); + bmc_set_group_state ( host_ptr, "failed" ); } _stage_change ( host_ptr->hostname, @@ -1342,7 +1342,7 @@ int hwmonHostClass::ipmi_sensor_monitor ( struct hwmonHostClass::hwmon_host * ho * * A stored checksum of zero indicates the first sample read. * If at that time host_ptr->sensors == 0 then a call to - * ipmi_create_sensor_model is made to create a new sensor + * bmc_create_sensor_model is made to create a new sensor * model based on these last sample readings. * * If the stored checksums do not match the current checksums @@ -1428,7 +1428,7 @@ int hwmonHostClass::ipmi_sensor_monitor ( struct hwmonHostClass::hwmon_host * ho } /* Create a sensor model from 'this' sample data */ - if ( ipmi_create_sensor_model ( host_ptr ) != PASS ) + if ( bmc_create_sensor_model ( host_ptr ) != PASS ) { elog ("%s failed to create sensor model (in sysinv)\n", host_ptr->hostname.c_str()); @@ -1499,9 +1499,9 @@ int hwmonHostClass::ipmi_sensor_monitor ( struct hwmonHostClass::hwmon_host * ho hwmonAlarm_clear ( host_ptr->hostname, HWMON_ALARM_ID__SENSORCFG, "profile", REASON_OK ); } - if ( ipmi_update_sensors ( host_ptr ) == PASS ) + if ( bmc_update_sensors ( host_ptr ) == PASS ) { - if ( ( rc = ipmi_set_group_state ( host_ptr, "enabled" ) ) == PASS ) + if ( ( rc = bmc_set_group_state ( host_ptr, "enabled" ) ) == PASS ) { _stage_change ( host_ptr->hostname, host_ptr->monitor_ctrl.stage, @@ -1604,7 +1604,7 @@ int hwmonHostClass::ipmi_sensor_monitor ( struct hwmonHostClass::hwmon_host * ho /* debounce of the transient 'na' case is debounced * if ( host_ptr->sensor_query_count > 5 ) - * log_sensor_data ( host_ptr, ptr->sensorname, ptr->status, get_ipmi_severity(ptr->sample_severity)); + * log_sensor_data ( host_ptr, ptr->sensorname, ptr->status, get_bmc_severity(ptr->sample_severity)); */ } @@ -1954,7 +1954,7 @@ int hwmonHostClass::ipmi_sensor_monitor ( struct hwmonHostClass::hwmon_host * ho if ( host_ptr->interval ) { - ipmi_set_group_state ( host_ptr, "failed" ) ; + bmc_set_group_state ( host_ptr, "failed" ) ; _stage_change ( host_ptr->hostname, host_ptr->monitor_ctrl.stage, diff --git a/mtce/src/hwmon/hwmonHttp.cpp b/mtce/src/hwmon/hwmonHttp.cpp index 6c4fe0a2..9157d8e5 100644 --- a/mtce/src/hwmon/hwmonHttp.cpp +++ b/mtce/src/hwmon/hwmonHttp.cpp @@ -857,7 +857,7 @@ void hwmonHttp_server_handler (struct evhttp_request *req, void *arg) { /* request sensor model relearn as a * background operation */ - obj_ptr->ipmi_learn_sensor_model (host_uuid) ; + obj_ptr->bmc_learn_sensor_model (host_uuid) ; http_status_code = HTTP_OK ; response = "{ \"status\" : \"pass\" }" ; } diff --git a/mtce/src/hwmon/hwmonModel.cpp b/mtce/src/hwmon/hwmonModel.cpp index 9a375122..c4b0552b 100644 --- a/mtce/src/hwmon/hwmonModel.cpp +++ b/mtce/src/hwmon/hwmonModel.cpp @@ -12,22 +12,22 @@ * These are the utilities that load, create, group and delete sensor models * * - * ipmi_load_sensor_model ....... called by add_host_handler FSM + * bmc_load_sensor_model ....... called by add_host_handler FSM * - * ipmi_create_sensor_model + * bmc_create_sensor_model * - * ipmi_create_sample_model ... create model based on sample data - * ipmi_create_groups - * ipmi_create_sensors - * ipmi_group_sensors + * bmc_create_sample_model ... create model based on sample data + * bmc_create_groups + * bmc_create_sensors + * bmc_group_sensors * - * ipmi_create_quanta_model ... create model for Quanta server - * ipmi_add_group + * bmc_create_quanta_model ... create model for Quanta server + * bmc_add_group * load_profile_groups * load_profile_sensors * hwmon_group_sensors * - * ipmi_delete_sensor_model ..... called on model re-create + * bmc_delete_sensor_model ..... called on model re-create * *****************************************************************************/ @@ -39,11 +39,11 @@ #include "hwmonClass.h" /* for ... service class definition */ #include "hwmonHttp.h" /* for ... http podule header */ #include "hwmonSensor.h" /* for ... this module header */ -#include "hwmonIpmi.h" /* for ... QUANTA_SENSOR_PROFILE_CHECKSUM */ +#include "hwmonBmc.h" /* for ... QUANTA_SENSOR_PROFILE_CHECKSUM */ /***************************************************************************** * - * Name : ipmi_create_sensor_model + * Name : bmc_create_sensor_model * * Description: Top level utility that creates a sensor model based on * sample data. @@ -55,7 +55,7 @@ * ******************************************************************************/ -int hwmonHostClass::ipmi_create_sensor_model ( struct hwmonHostClass::hwmon_host * host_ptr ) +int hwmonHostClass::bmc_create_sensor_model ( struct hwmonHostClass::hwmon_host * host_ptr ) { int rc = PASS ; ilog ("%s creating sensor model\n", host_ptr->hostname.c_str()); @@ -69,13 +69,13 @@ int hwmonHostClass::ipmi_create_sensor_model ( struct hwmonHostClass::hwmon_host * Dynamically create a model based * on the sensor sample reading data. */ - rc = ipmi_create_sample_model ( host_ptr ); + rc = bmc_create_sample_model ( host_ptr ); } /* Otherwise create the model based on the known Quanta sensor profile */ else { - if ( ( rc = ipmi_create_quanta_model ( host_ptr )) == PASS ) + if ( ( rc = bmc_create_quanta_model ( host_ptr )) == PASS ) { if ( host_ptr->groups >= MIN_SENSOR_GROUPS ) { @@ -216,26 +216,26 @@ int hwmonHostClass::ipmi_create_sensor_model ( struct hwmonHostClass::hwmon_host /****************************************************************************** * - * Name : ipmi_create_sample_model + * Name : bmc_create_sample_model * * Description: Create a sensor model based on sample data. * ******************************************************************************/ -int hwmonHostClass::ipmi_create_sample_model ( struct hwmonHostClass::hwmon_host * host_ptr ) +int hwmonHostClass::bmc_create_sample_model ( struct hwmonHostClass::hwmon_host * host_ptr ) { int rc = FAIL ; if ( host_ptr->samples ) { /* Start by creating a set of sensor groups based on sample data * and specifically sensor type and save those groups in the database */ - if ( ( rc = ipmi_create_groups ( host_ptr ) ) == PASS ) + if ( ( rc = bmc_create_groups ( host_ptr ) ) == PASS ) { /* add all the sensors to hwmon and save that in the database */ - if ( ( rc = ipmi_create_sensors ( host_ptr ) ) == PASS ) + if ( ( rc = bmc_create_sensors ( host_ptr ) ) == PASS ) { /* add the sensors to the groups and save that in the database */ - rc = ipmi_group_sensors ( host_ptr ); + rc = bmc_group_sensors ( host_ptr ); } } } @@ -250,13 +250,13 @@ int hwmonHostClass::ipmi_create_sample_model ( struct hwmonHostClass::hwmon_host /****************************************************************************** * - * Name : ipmi_create_quanta_model + * Name : bmc_create_quanta_model * * Description: Create a static Quanta sever sensor group model. * ******************************************************************************/ -int hwmonHostClass::ipmi_create_quanta_model ( struct hwmonHostClass::hwmon_host * host_ptr ) +int hwmonHostClass::bmc_create_quanta_model ( struct hwmonHostClass::hwmon_host * host_ptr ) { int status = PASS ; int rc = PASS ; @@ -265,26 +265,26 @@ int hwmonHostClass::ipmi_create_quanta_model ( struct hwmonHostClass::hwmon_host { if ( host_ptr->quanta_server == true ) { - rc = ipmi_add_group ( host_ptr , DISCRETE, "fan" , HWMON_CANNED_GROUP__FANS, "server fans", "show /SYS/fan"); + rc = bmc_add_group ( host_ptr , DISCRETE, "fan" , HWMON_CANNED_GROUP__FANS, "server fans", "show /SYS/fan"); if (( rc ) && ( !status )) status = rc ; - rc = ipmi_add_group ( host_ptr , DISCRETE, "fan" , HWMON_CANNED_GROUP__FANS, "power supply fans", "show /SYS/fan"); + rc = bmc_add_group ( host_ptr , DISCRETE, "fan" , HWMON_CANNED_GROUP__FANS, "power supply fans", "show /SYS/fan"); if (( rc ) && ( !status )) status = rc ; - rc = ipmi_add_group ( host_ptr , DISCRETE, "power" , HWMON_CANNED_GROUP__POWER, "server power", "show /SYS/powerSupply"); + rc = bmc_add_group ( host_ptr , DISCRETE, "power" , HWMON_CANNED_GROUP__POWER, "server power", "show /SYS/powerSupply"); if (( rc ) && ( !status )) status = rc ; - rc = ipmi_add_group ( host_ptr , DISCRETE, "temperature" , HWMON_CANNED_GROUP__TEMP, "server temperature", "show /SYS/temperature"); + rc = bmc_add_group ( host_ptr , DISCRETE, "temperature" , HWMON_CANNED_GROUP__TEMP, "server temperature", "show /SYS/temperature"); if (( rc ) && ( !status )) status = rc ; - rc = ipmi_add_group ( host_ptr , DISCRETE, "voltage" , HWMON_CANNED_GROUP__VOLT, "server voltage", "show /SYS/voltage"); + rc = bmc_add_group ( host_ptr , DISCRETE, "voltage" , HWMON_CANNED_GROUP__VOLT, "server voltage", "show /SYS/voltage"); if (( rc ) && ( !status )) status = rc ; } } return (status); } -int hwmonHostClass::ipmi_delete_sensor_model ( struct hwmonHostClass::hwmon_host * host_ptr ) +int hwmonHostClass::bmc_delete_sensor_model ( struct hwmonHostClass::hwmon_host * host_ptr ) { int rc = PASS ; @@ -402,7 +402,7 @@ int hwmonHostClass::ipmi_delete_sensor_model ( struct hwmonHostClass::hwmon_host /* ************************************************************************* * - * Name : ipmi_load_sensor_model + * Name : bmc_load_sensor_model * * Description: Called from the add_handler to load sensors and groups * for the specified host from the sysinv database. @@ -411,7 +411,7 @@ int hwmonHostClass::ipmi_delete_sensor_model ( struct hwmonHostClass::hwmon_host * already loaded sensor profile. * * Assumptions: Inservice sensor model reprovisioning is done with - * ipmi_delete_sensor_model and ipmi_create_sensor_model API. + * bmc_delete_sensor_model and bmc_create_sensor_model API. * * * Scope : private hwmonHostClass @@ -421,7 +421,7 @@ int hwmonHostClass::ipmi_delete_sensor_model ( struct hwmonHostClass::hwmon_host * Returns : TODO: handle modify errors better. * * *************************************************************************/ -int hwmonHostClass::ipmi_load_sensor_model ( struct hwmonHostClass::hwmon_host * host_ptr ) +int hwmonHostClass::bmc_load_sensor_model ( struct hwmonHostClass::hwmon_host * host_ptr ) { int rc ; @@ -537,7 +537,7 @@ int hwmonHostClass::ipmi_load_sensor_model ( struct hwmonHostClass::hwmon_host * if (( host_ptr->sensors ) || (host_ptr->groups )) { wlog ("%s has a corrupt sensor profile ; deleting ...\n", host_ptr->hostname.c_str()); - ipmi_delete_sensor_model ( host_ptr ); + bmc_delete_sensor_model ( host_ptr ); } } } diff --git a/mtce/src/hwmon/hwmonSensor.cpp b/mtce/src/hwmon/hwmonSensor.cpp index d91f54e7..5f4a2e50 100644 --- a/mtce/src/hwmon/hwmonSensor.cpp +++ b/mtce/src/hwmon/hwmonSensor.cpp @@ -17,7 +17,7 @@ #include "hwmonClass.h" /* for ... service class definition */ #include "hwmonHttp.h" /* for ... hwmonHttp_load_sensors */ #include "hwmonSensor.h" /* for ... this module header */ -#include "hwmonGroup.h" /* for ... ipmi_get_grouptype */ +#include "hwmonGroup.h" /* for ... bmc_get_grouptype */ #include "hwmonAlarm.h" /* for ... hwmonAlarm */ #define DELIMITER ((const char)',') @@ -2138,13 +2138,13 @@ int hwmonHostClass::group_modify ( string hostname, string group_uuid, string ke /***************************************************************************** * - * Name : ipmi_create_sensors + * Name : bmc_create_sensors * * Description: Add sample sensors to the sysinv database. * *****************************************************************************/ -int hwmonHostClass::ipmi_create_sensors ( struct hwmonHostClass::hwmon_host * host_ptr ) +int hwmonHostClass::bmc_create_sensors ( struct hwmonHostClass::hwmon_host * host_ptr ) { int rc = PASS ; int sensor_errors = 0 ; @@ -2152,7 +2152,7 @@ int hwmonHostClass::ipmi_create_sensors ( struct hwmonHostClass::hwmon_host * ho for ( int s = 0 ; s < host_ptr->samples ; ++s ) { - string sensortype = ipmi_get_grouptype ( host_ptr->hostname, + string sensortype = bmc_get_grouptype ( host_ptr->hostname, host_ptr->sample[s].unit, host_ptr->sample[s].name); @@ -2229,9 +2229,9 @@ int hwmonHostClass::ipmi_create_sensors ( struct hwmonHostClass::hwmon_host * ho /***************************************************************************** * - * Name : ipmi_disable_sensors + * Name : bmc_disable_sensors * - * Purpose : With the introduction of ipmi monitoring, all groups are + * Purpose : With the introduction of bmc monitoring, all groups are * monitored at once. Therefore all should be in the same state. * * Description: Set all sensors to specified state. @@ -2239,7 +2239,7 @@ int hwmonHostClass::ipmi_create_sensors ( struct hwmonHostClass::hwmon_host * ho * ******************************************************************************/ -int hwmonHostClass::ipmi_disable_sensors ( struct hwmonHostClass::hwmon_host * host_ptr ) +int hwmonHostClass::bmc_disable_sensors ( struct hwmonHostClass::hwmon_host * host_ptr ) { int rc = FAIL_NULL_POINTER ; if ( host_ptr ) diff --git a/mtce/src/hwmon/hwmonThreads.cpp b/mtce/src/hwmon/hwmonThreads.cpp index ea365296..808ced8d 100644 --- a/mtce/src/hwmon/hwmonThreads.cpp +++ b/mtce/src/hwmon/hwmonThreads.cpp @@ -20,6 +20,7 @@ #include #include #include +#include using namespace std; @@ -28,15 +29,17 @@ using namespace std; #include "nodeBase.h" /* for ... mtce node common definitions */ #include "bmcUtil.h" /* for ... mtce-common board management */ #include "hostUtil.h" /* for ... mtce host common definitions */ +#include "jsonUtil.h" /* for ... common Json utilities */ +#include "bmcUtil.h" #include "nodeMacro.h" #include "threadUtil.h" #include "hwmonThreads.h" /* for ... BMC_THREAD_CMD__READ_SENSORS */ -#include "hwmonIpmi.h" /* for ... MAX_IPMITOOL_PARSE_ERRORS */ +#include "hwmonBmc.h" /* for ... MAX_IPMITOOL_PARSE_ERRORS */ #include "hwmonClass.h" /* for ... thread_extra_info_type */ /*************************************************************************** * - * Name : ipmitool_sample_type + * Name : bmc_sample_type * * Description: An array of sensor data. * @@ -44,7 +47,7 @@ using namespace std; * ***************************************************************************/ -static ipmitool_sample_type _sample_list[MAX_HOST_SENSORS] ; +static bmc_sample_type _sample_list[MAX_HOST_SENSORS] ; /*************************************************************************** * @@ -55,7 +58,7 @@ static ipmitool_sample_type _sample_list[MAX_HOST_SENSORS] ; static void _command_not_supported ( thread_info_type * info_ptr ) { info_ptr->data = "{\"" ; - info_ptr->data.append(IPMITOOL_JSON__SENSOR_DATA_MESSAGE_HEADER); + info_ptr->data.append(BMC_JSON__SENSOR_DATA_MESSAGE_HEADER); info_ptr->data.append("\":{"); info_ptr->data.append("\"status\":"); info_ptr->data.append(itos(info_ptr->status)); @@ -68,7 +71,7 @@ static void _command_not_supported ( thread_info_type * info_ptr ) } -static void _add_json_sensor_tuple ( ipmitool_sample_type * ptr, string & response ) +static void _add_json_sensor_tuple ( bmc_sample_type * ptr, string & response ) { response.append ("{\"n\":\""); response.append (ptr->name); @@ -141,7 +144,7 @@ static void _parse_sensor_data ( thread_info_type * info_ptr ) int samples = extra_info_ptr->samples ; info_ptr->data = "{\"" ; - info_ptr->data.append (IPMITOOL_JSON__SENSOR_DATA_MESSAGE_HEADER); + info_ptr->data.append (BMC_JSON__SENSOR_DATA_MESSAGE_HEADER); info_ptr->data.append ("\":{\"status\":"); info_ptr->data.append(itos(info_ptr->status)); info_ptr->data.append(","); @@ -158,7 +161,7 @@ static void _parse_sensor_data ( thread_info_type * info_ptr ) } info_ptr->data.append (",\""); - info_ptr->data.append (IPMITOOL_JSON__SENSORS_LABEL); + info_ptr->data.append (BMC_JSON__SENSORS_LABEL); info_ptr->data.append ("\":["); for ( int i = 0 ; i < samples ; ) { @@ -178,7 +181,6 @@ static void _parse_sensor_data ( thread_info_type * info_ptr ) } } - /***************************************************************************** * * Name : _get_field @@ -206,7 +208,7 @@ static void _parse_sensor_data ( thread_info_type * info_ptr ) #define PARSE_ERROR_STR ((const char *)("parse error")) -void _get_field ( char * src_ptr , int field, char * dst_ptr ) +void _ipmitool_get_field ( char * src_ptr , int field, char * dst_ptr ) { int src = 0 ; char * saved_dst_ptr = dst_ptr ; @@ -452,7 +454,10 @@ void * hwmonThread_ipmitool ( void * arg ) goto ipmitool_thread_done ; } - ipmiUtil_create_pw_fn ( info_ptr, extra_ptr->bm_pw ) ; + bmcUtil_create_pw_file ( info_ptr, + extra_ptr->bm_pw, + BMC_PROTOCOL__IPMITOOL); + if ( info_ptr->password_file.empty() ) { info_ptr->status_string = "failed to get a temporary password filename" ; @@ -467,7 +472,7 @@ void * hwmonThread_ipmitool ( void * arg ) /*************** Create the output filename ***************/ string sensor_datafile = bmcUtil_create_data_fn (info_ptr->hostname, - IPMITOOL_SENSOR_OUTPUT_FILE_SUFFIX, + BMC_SENSOR_OUTPUT_FILE_SUFFIX, BMC_PROTOCOL__IPMITOOL ) ; dlog_t ("%s sensor output file%s\n", @@ -505,7 +510,7 @@ void * hwmonThread_ipmitool ( void * arg ) { rc = PASS ; // ilog ("%s FIT Avoiding Sensor Query\n", info_ptr->hostname.c_str()); } - else if ( daemon_want_fit ( FIT_CODE__AVOID_N_FAIL_IPMITOOL_REQUEST, info_ptr->hostname )) + else if ( daemon_want_fit ( FIT_CODE__AVOID_N_FAIL_BMC_REQUEST, info_ptr->hostname )) { rc = FAIL ; // ilog ("%s FIT Avoiding Sensor Query\n", info_ptr->hostname.c_str()); } @@ -650,19 +655,19 @@ void * hwmonThread_ipmitool ( void * arg ) blog3_t ("%s Line:%d is a '%s' sensor\n", info_ptr->log_prefix, line, type ); } - _get_field ( buffer, 0, _sample_list[samples].name ); - _get_field ( buffer, 1, _sample_list[samples].value ); + _ipmitool_get_field ( buffer, 0, _sample_list[samples].name ); + _ipmitool_get_field ( buffer, 1, _sample_list[samples].value ); /* copy already learned type to unit field 2 */ snprintf ( _sample_list[samples].unit, strlen(type)+1, "%s", type ); - _get_field ( buffer, 3, _sample_list[samples].status ); - _get_field ( buffer, 4, _sample_list[samples].lnr ); - _get_field ( buffer, 5, _sample_list[samples].lcr ); - _get_field ( buffer, 6, _sample_list[samples].lnc ); - _get_field ( buffer, 7, _sample_list[samples].unc ); - _get_field ( buffer, 8, _sample_list[samples].ucr ); - _get_field ( buffer, 9, _sample_list[samples].unr ); + _ipmitool_get_field ( buffer, 3, _sample_list[samples].status ); + _ipmitool_get_field ( buffer, 4, _sample_list[samples].lnr ); + _ipmitool_get_field ( buffer, 5, _sample_list[samples].lcr ); + _ipmitool_get_field ( buffer, 6, _sample_list[samples].lnc ); + _ipmitool_get_field ( buffer, 7, _sample_list[samples].unc ); + _ipmitool_get_field ( buffer, 8, _sample_list[samples].ucr ); + _ipmitool_get_field ( buffer, 9, _sample_list[samples].unr ); blog2_t ("%s | %20s | %8s | %12s | %3s | %8s | %8s | %8s | %8s | %8s | %8s |\n", info_ptr->log_prefix, _sample_list[samples].name, @@ -734,9 +739,8 @@ void * hwmonThread_ipmitool ( void * arg ) else { info_ptr->status = FAIL_FILE_ACCESS ; - info_ptr->status_string = "failed to open sensor data file: <"; + info_ptr->status_string = "failed to open sensor data file: "; info_ptr->status_string.append(sensor_datafile); - info_ptr->status_string.append(">"); } } /* end else handling of successful system command */ break ; @@ -785,3 +789,550 @@ ipmitool_thread_done: pthread_exit (&info_ptr->status ); return NULL ; } + +/***************************************************************************** + * + * Name : _set_default_unit_type_for_sensor + * Description : Set default unit type for sensor + * Parameters : label - sensor label + samples - sensor index in global_sample_list array + * + *****************************************************************************/ + +static void _set_default_unit_type_for_sensor( thread_info_type * info_ptr, + string label, int samples) +{ + if ( label == REDFISH_SENSOR_LABEL_VOLT ) + { + strcpy( _sample_list[samples].unit, BMC_SENSOR_DEFAULT_UNIT_TYPE_VOLT ); + } + else if ( label == REDFISH_SENSOR_LABEL_TEMP ) + { + strcpy( _sample_list[samples].unit, BMC_SENSOR_DEFAULT_UNIT_TYPE_TEMP); + } + else if ( label == REDFISH_SENSOR_LABEL_POWER_CTRL ) + { + strcpy( _sample_list[samples].unit, BMC_SENSOR_DEFAULT_UNIT_TYPE_POWER); + } + else if ( label == REDFISH_SENSOR_LABEL_FANS ) + { + strcpy( _sample_list[samples].unit, BMC_SENSOR_DEFAULT_UNIT_TYPE_FANS); + } + else + { + dlog_t ("%s unrecognized label\n", info_ptr->log_prefix); + } +} + +/***************************************************************************** + * + * Name : _parse_redfish_sensor_data + * Purpose : Parse redfish command response + * Description : Parse json string and store sensor data to _sample_list. + * Parameters : json_str_ptr - the json string read from the file of command response. + info_ptr - thread info + label - json key, like "Voltages", "PowerControl" + reading_label - json key, like "ReadingVolts", "PowerConsumedWatts" + samples - sensor data index for _sample_list array. + * Returns : PASS if parse data successfully. + * + *****************************************************************************/ + +/* Get value from json string according to key, if value is none, return na + Put the value to _sample_list */ +#define GET_SENSOR_DATA_VALUE( temp_str, json_obj, key, para ) \ + temp_str = jsonUtil_get_key_value_string ( json_obj, key ); \ + if ( !strcmp (temp_str.data(),"none" )) temp_str = "na" ; \ + strcpy( _sample_list[samples].para , temp_str.c_str() ); + +static int _parse_redfish_sensor_data( char * json_str_ptr, thread_info_type * info_ptr, + string label, const char * reading_label, int & samples ) +{ + int rc = PASS ; + struct json_object *json_obj = NULL; + std::list sensor_list ; + std::list::iterator iter_curr_ptr ; + string status_str; + string temp_str; + + sensor_list.clear(); + + rc = jsonUtil_get_list(json_str_ptr, label, sensor_list); + if ( rc == PASS ) + { + for ( iter_curr_ptr = sensor_list.begin(); + iter_curr_ptr != sensor_list.end() ; + ++iter_curr_ptr ) + { + json_obj = json_tokener_parse((char*)iter_curr_ptr->data()); + if ( !json_obj ) + { + elog_t ("%s no or invalid sensor record\n", info_ptr->hostname.c_str()); + return (FAIL_JSON_PARSE); + } + /* parse value from json string according to key, if value is none, return na + Put the value to _sample_list */ + GET_SENSOR_DATA_VALUE( temp_str, json_obj, "Name", name ) + GET_SENSOR_DATA_VALUE( temp_str, json_obj, reading_label, value ) + GET_SENSOR_DATA_VALUE( temp_str, json_obj, "LowerThresholdNonRecoverable", lnr ) + GET_SENSOR_DATA_VALUE( temp_str, json_obj, "LowerThresholdCritical", lcr ) + GET_SENSOR_DATA_VALUE( temp_str, json_obj, "LowerThresholdNonCritical", lnc ) + GET_SENSOR_DATA_VALUE( temp_str, json_obj, "UpperThresholdNonCritical", unc ) + GET_SENSOR_DATA_VALUE( temp_str, json_obj, "UpperThresholdCritical", ucr ) + GET_SENSOR_DATA_VALUE( temp_str, json_obj, "UpperThresholdNonRecoverable", unr ) + GET_SENSOR_DATA_VALUE( temp_str, json_obj, "ReadingUnits", unit ) + + /* Set default unit type if can not get unit type from json string */ + if ( !strcmp(_sample_list[samples].unit, "na") ) + { + _set_default_unit_type_for_sensor( info_ptr, label, samples ); + } + + /* Parse and store status to _sample_list[samples].status */ + status_str = jsonUtil_get_key_value_string ( json_obj, "Status" ); + if ( strcmp (status_str.data(),"none" )) + { + struct json_object *json_status_obj = json_tokener_parse((char*)status_str.data()); + if ( json_status_obj ) + { + string state = jsonUtil_get_key_value_string ( json_status_obj, "State" ); + string health = jsonUtil_get_key_value_string ( json_status_obj, "Health" ); + // string healthRollup = jsonUtil_get_key_value_string ( json_status_obj, "HealthRollup" ); + if ( !strcmp (state.data(),"Enabled" )) + { + if ( !strcmp (health.data(), REDFISH_SEVERITY__GOOD )) + { + strcpy(_sample_list[samples].status, "ok"); + } + else if (!strcmp (health.data(), REDFISH_SEVERITY__MAJOR )) + { + strcpy(_sample_list[samples].status, "nc"); + } + else if (!strcmp (health.data(), REDFISH_SEVERITY__CRITICAL )) + { + strcpy(_sample_list[samples].status, "cr"); + } + else + { + strcpy(_sample_list[samples].status, "na"); + } + } + else + { + strcpy(_sample_list[samples].status, "na"); + } + json_object_put(json_status_obj); + } + } + else + { + strcpy(_sample_list[samples].status, "na"); + } + + if (json_obj) json_object_put(json_obj); + + samples++ ; + if ( samples >= MAX_HOST_SENSORS ) + { + samples-- ; + rc = info_ptr->status = FAIL_OUT_OF_RANGE ; + info_ptr->status_string = "max number of sensors reached"; + break ; + } + } + } + + return (rc); +} + +/***************************************************************************** + * + * Name : _redfishUtil_send_request + * Description : Construct redfishtool request and send it out + * Parameters : info_ptr - thread info + redfishtool_datafile - date file used for storing redfishtool comand response + file_suffix - file suffix for redfishtool_datafile name + redfish_cmd_str - redfish command string + * Returns : PASS if command sent out successfully. + * + *****************************************************************************/ + +static int _redfishUtil_send_request( thread_info_type * info_ptr, string & redfishtool_datafile, + const char * file_suffix, const char * redfish_cmd_str ) +{ + string redfishtool_request = "" ; + string pw_file_content = "" ; + int rc = PASS ; + thread_extra_info_type * extra_ptr = (thread_extra_info_type*)info_ptr->extra_info_ptr ; + + info_ptr->status_string = "" ; + info_ptr->status = PASS ; + + if ( extra_ptr == NULL ) + { + info_ptr->status = FAIL_NULL_POINTER ; + info_ptr->status_string = "null extra info pointer" ; + return FAIL ; + } + + /**************** Create the password file *****************/ + pw_file_content = "{\"user\" : \"" ; + pw_file_content.append(extra_ptr->bm_un) ; + pw_file_content.append("\", \"password\" : \"") ; + pw_file_content.append(extra_ptr->bm_pw) ; + pw_file_content.append("\"}") ; + + bmcUtil_create_pw_file ( info_ptr, pw_file_content, BMC_PROTOCOL__REDFISHTOOL ) ; + if ( info_ptr->password_file.empty() ) + { + info_ptr->status_string = "failed to get a temporary password filename" ; + info_ptr->status = FAIL_FILE_CREATE ; + return FAIL ; + } + + dlog_t ("%s password filename : %s\n", + info_ptr->log_prefix, + info_ptr->password_file.c_str()); + + /*************** Create the output filename ***************/ + redfishtool_datafile = + bmcUtil_create_data_fn (info_ptr->hostname, file_suffix, BMC_PROTOCOL__REDFISHTOOL ) ; + dlog_t ("%s create data filename : %s\n", + info_ptr->log_prefix, + redfishtool_datafile.c_str()); + + /************** Create the redfishtool request **************/ + redfishtool_request = + redfishUtil_create_request ( redfish_cmd_str, + extra_ptr->bm_ip, + info_ptr->password_file, + redfishtool_datafile ); + + dlog_t ("%s query cmd: %s\n", + info_ptr->log_prefix, + redfishtool_request.c_str()); + + if ( ( info_ptr->command == BMC_THREAD_CMD__BMC_INFO + && daemon_is_file_present ( MTC_CMD_FIT__MC_INFO ) ) + || ( info_ptr->command == BMC_THREAD_CMD__POWER_STATUS + && daemon_is_file_present ( MTC_CMD_FIT__POWER_STATUS ) ) ) + { + slog ("%s FIT CMD : %s\n", info_ptr->hostname.c_str(), redfish_cmd_str); + rc = PASS ; + } + else if ( info_ptr->command == BMC_THREAD_CMD__READ_SENSORS ) + { + if( daemon_is_file_present ( MTC_CMD_FIT__SENSOR_DATA )) + { + rc = PASS ; + } +#ifdef WANT_FIT_TESTING + else if ( daemon_want_fit ( FIT_CODE__HWMON__AVOID_SENSOR_QUERY, info_ptr->hostname )) + { + rc = PASS ; // ilog ("%s FIT Avoiding Sensor Query\n", info_ptr->hostname.c_str()); + } + else if ( daemon_want_fit ( FIT_CODE__AVOID_N_FAIL_BMC_REQUEST, info_ptr->hostname )) + { + rc = FAIL ; // ilog ("%s FIT Avoiding Sensor Query\n", info_ptr->hostname.c_str()); + } + else + { + /* Make the request */ + rc = system ( redfishtool_request.data()) ; + } +#endif + } + else + { + /* Make the request */ + rc = system ( redfishtool_request.data()) ; + } + + unlink(info_ptr->password_file.data()); + daemon_remove_file (info_ptr->password_file.data()); + + /* check for system call error case */ + if ( rc != PASS ) + { + info_ptr->status_string = "system call failed for info query ; " ; + info_ptr->status_string.append(redfishtool_request); + info_ptr->status = FAIL_SYSTEM_CALL ; + } + return (rc) ; +} + +/***************************************************************************** + * + * Name : wait_for_command_output + * Description : Wait for some time to check if redfishtool command output is available. + * Parameters : info_ptr - thread info + redfishtool_datafile - date file used for storing redfishtool comand response + * Returns : True if command response file is availalbe + False if command response file is unavailable after timeout. + * + *****************************************************************************/ + +static bool _wait_for_command_output( thread_info_type * info_ptr, string & redfishtool_datafile ) +{ + /* look for the output data file */ + for ( int i = 0 ; i < 10 ; i++ ) + { + pthread_signal_handler ( info_ptr ); + if ( daemon_is_file_present ( redfishtool_datafile.data() )) + { + return true ; + } + info_ptr->progress++ ; + sleep (1); + } + + info_ptr->status_string = "command did not produce output file ; timeout" ; + info_ptr->status = FAIL_FILE_ACCESS ; + return false ; +} + +/***************************************************************************** + * + * Name : _parse_redfish_sensor_data_output_file + * Description : Parse power and thermal sensor data + * Parameters : info_ptr - thread info + sensor_group - power & thermal group + redfishtool_datafile - date file used for storing redfishtool comand response + samples - sensor data index for _sample_list array. + * Returns : PASS if file access is OK + * + *****************************************************************************/ + +static int _parse_redfish_sensor_data_output_file( thread_info_type * info_ptr, + int sensor_group, + string & redfishtool_datafile, + int & samples ) +{ + FILE * _fp = fopen ( redfishtool_datafile.data(), "r" ); + + if ( _fp ) + { + struct stat st; + char buffer[HWMON_MAX_BMC_DATA_BUF_SIZE]; + + /* zero the buffer according to the file size */ + if( fstat(fileno(_fp), &st) != 0 || (st.st_size + 2) > HWMON_MAX_BMC_DATA_BUF_SIZE) + { + elog_t ("%s file size is abnormal or bigger than buffer size\n", + info_ptr->hostname.c_str()); + return FAIL ; + } + else + { + memset (buffer, 0, (st.st_size + 2) ); + } + fread(buffer,(st.st_size + 2), 1, _fp); + fclose(_fp); + + switch (sensor_group) + { + case BMC_SENSOR_POWER_GROUP: + { + _parse_redfish_sensor_data( buffer, info_ptr, REDFISH_SENSOR_LABEL_VOLT, + REDFISH_SENSOR_LABEL_VOLT_READING, samples); + _parse_redfish_sensor_data( buffer, info_ptr, REDFISH_SENSOR_LABEL_POWER_SUPPLY, + REDFISH_SENSOR_LABEL_POWER_SUPPLY_READING, samples); + _parse_redfish_sensor_data( buffer, info_ptr, REDFISH_SENSOR_LABEL_POWER_CTRL, + REDFISH_SENSOR_LABEL_POWER_CTRL_READING, samples); + return PASS; + } + case BMC_SENSOR_THERMAL_GROUP: + { + _parse_redfish_sensor_data( buffer, info_ptr, REDFISH_SENSOR_LABEL_TEMP, + REDFISH_SENSOR_LABEL_TEMP_READING, samples); + _parse_redfish_sensor_data( buffer, info_ptr, REDFISH_SENSOR_LABEL_FANS, + REDFISH_SENSOR_LABEL_FANS_READING, samples); + return PASS; + } + default: + { + elog_t ("%s unsupported command failure\n", + info_ptr->hostname.c_str()); + } + } + } + else + { + info_ptr->status = FAIL_FILE_ACCESS ; + info_ptr->status_string = "failed to open sensor data file: "; + info_ptr->status_string.append(redfishtool_datafile); + } + + return FAIL ; +} + +/***************************************************************************** + * + * Name : hwmonThread_redfish + * Purpose : This thread used for sending redfishtool command + * Description : hwmon thread main function + * + *****************************************************************************/ + +void * hwmonThread_redfish ( void * arg ) +{ + int samples ; + + thread_info_type * info_ptr ; + thread_extra_info_type * extra_ptr ; + string redfishtool_datafile = ""; + + /* Pointer Error Detection and Handling */ + if ( !arg ) + { + slog ("*** redfishtool thread called with null arg pointer *** corruption\n"); + return NULL ; + } + + /* cast pointers from arg */ + info_ptr = (thread_info_type*)arg ; + extra_ptr = (thread_extra_info_type*)info_ptr->extra_info_ptr ; + + info_ptr->pw_file_fd = 0 ; + + /* allow the parent to confirm thread id */ + info_ptr->id = pthread_self() ; + if ( extra_ptr == NULL ) + { + info_ptr->status_string = "null 'extra info' pointer" ; + info_ptr->status = FAIL_NULL_POINTER ; + goto redfishtool_thread_done ; + } + + /* Set cancellation option so that a delete operation + * can kill this thread immediately */ + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL ); + + /* the number of sensors learned */ + extra_ptr->samples = samples = 0 ; + + switch ( info_ptr->command ) + { + case BMC_THREAD_CMD__READ_SENSORS: + { + blog2_t ("%s read power sensors \n", info_ptr->log_prefix); + if ( _redfishUtil_send_request( info_ptr, redfishtool_datafile, + BMC_SENSOR_OUTPUT_FILE_SUFFIX, + REDFISHTOOL_READ_POWER_SENSORS_CMD ) == PASS ) + { + /* look for the output data file */ + if( _wait_for_command_output(info_ptr, redfishtool_datafile) ) + { + _parse_redfish_sensor_data_output_file( info_ptr, BMC_SENSOR_POWER_GROUP, + redfishtool_datafile, samples ); + } + else + { + break ; + } + } + + blog2_t ("%s read thermal sensors \n", info_ptr->log_prefix); + if (_redfishUtil_send_request( info_ptr, redfishtool_datafile, + BMC_SENSOR_OUTPUT_FILE_SUFFIX, + REDFISHTOOL_READ_THERMAL_SENSORS_CMD ) == PASS ) + { + /* look for the output data file */ + if( _wait_for_command_output(info_ptr, redfishtool_datafile) ) + { + _parse_redfish_sensor_data_output_file( info_ptr, BMC_SENSOR_THERMAL_GROUP, + redfishtool_datafile, samples ); + } + } + + extra_ptr->samples = samples ; + if ( samples == 0 ) + { + info_ptr->status = FAIL_NO_DATA ; + info_ptr->status_string = "no sensor data found"; + } + else + { + info_ptr->status_string = "pass" ; + info_ptr->status = PASS ; + } + break ; + } + case BMC_THREAD_CMD__BMC_INFO: + { + blog2_t ("%s query BMC info\n", info_ptr->log_prefix); + if (_redfishUtil_send_request( info_ptr, redfishtool_datafile, + BMC_INFO_FILE_SUFFIX, REDFISHTOOL_BMC_INFO_CMD ) + == PASS ) + { + /* look for the output data file */ + if( _wait_for_command_output(info_ptr, redfishtool_datafile) ) + { + info_ptr->data = daemon_read_file (redfishtool_datafile.data()) ; + dlog_t ("%s data:%s\n", + info_ptr->hostname.c_str(), + info_ptr->data.data()); + + info_ptr->status_string = "pass" ; + info_ptr->status = PASS ; + } + } + break ; + } + case BMC_THREAD_CMD__POWER_STATUS: + { + blog2_t ("%s query power status info\n", info_ptr->log_prefix); + if ( _redfishUtil_send_request( info_ptr, redfishtool_datafile, + BMC_POWER_STATUS_FILE_SUFFIX, + REDFISHTOOL_POWER_STATUS_CMD ) == PASS ) + { + /* look for the output data file */ + if( _wait_for_command_output(info_ptr, redfishtool_datafile) ) + { + info_ptr->data = daemon_read_file (redfishtool_datafile.data()) ; + dlog_t ("%s data:%s\n", + info_ptr->hostname.c_str(), + info_ptr->data.data()); + + info_ptr->status_string = "pass" ; + info_ptr->status = PASS ; + } + } + break ; + } + default: + { + info_ptr->status = FAIL_BAD_CASE ; + _command_not_supported ( info_ptr ); + break ; + } + } + +redfishtool_thread_done: + + if ( info_ptr->pw_file_fd > 0 ) + close(info_ptr->pw_file_fd); + info_ptr->pw_file_fd = 0 ; + + if ( ! info_ptr->password_file.empty() ) + { + unlink(info_ptr->password_file.data()); + daemon_remove_file ( info_ptr->password_file.data() ) ; + info_ptr->password_file.clear(); + } + + pthread_signal_handler ( info_ptr ); + + /* Sensor reading specific exit */ + if ( info_ptr->command == BMC_THREAD_CMD__READ_SENSORS ) + { + _parse_sensor_data ( info_ptr ); + } + + info_ptr->progress++ ; + info_ptr->runcount++ ; + info_ptr->id = 0 ; + pthread_exit (&info_ptr->status ); + return NULL ; +} diff --git a/mtce/src/hwmon/hwmonThreads.h b/mtce/src/hwmon/hwmonThreads.h index c4c2d6b4..6aa3c729 100644 --- a/mtce/src/hwmon/hwmonThreads.h +++ b/mtce/src/hwmon/hwmonThreads.h @@ -18,8 +18,32 @@ #define IPMITOOL_MAX_FIELD_LEN (64) #define IPMITOOL_FIT_LINE_LEN (1000) -void * hwmonThread_ipmitool ( void * ); +#define REDFISH_SENSOR_LABEL_VOLT "Voltages" +#define REDFISH_SENSOR_LABEL_TEMP "Temperatures" +#define REDFISH_SENSOR_LABEL_FANS "Fans" +#define REDFISH_SENSOR_LABEL_POWER_SUPPLY "PowerSupplies" +#define REDFISH_SENSOR_LABEL_POWER_CTRL "PowerControl" +#define REDFISH_SENSOR_LABEL_VOLT_READING "ReadingVolts" +#define REDFISH_SENSOR_LABEL_TEMP_READING "ReadingCelsius" +#define REDFISH_SENSOR_LABEL_FANS_READING "Reading" +#define REDFISH_SENSOR_LABEL_POWER_SUPPLY_READING "None" +#define REDFISH_SENSOR_LABEL_POWER_CTRL_READING "PowerConsumedWatts" + +#define REDFISH_SEVERITY__GOOD "OK" +#define REDFISH_SEVERITY__MAJOR "Warning" +#define REDFISH_SEVERITY__CRITICAL "Critical" + +#define BMC_SENSOR_DEFAULT_UNIT_TYPE_TEMP "degrees" +#define BMC_SENSOR_DEFAULT_UNIT_TYPE_VOLT "Volts" +#define BMC_SENSOR_DEFAULT_UNIT_TYPE_FANS "RPM" +#define BMC_SENSOR_DEFAULT_UNIT_TYPE_POWER "Watts" + +#define BMC_SENSOR_POWER_GROUP 0 +#define BMC_SENSOR_THERMAL_GROUP 1 + +void * hwmonThread_ipmitool ( void * ); +void * hwmonThread_redfish ( void * ); /* -------------------- * ipmitool_sensor_data: outgoing message * -------------------- @@ -128,19 +152,20 @@ void * hwmonThread_ipmitool ( void * ); using namespace std; -// #define MAX_HOST_SENSORS (100) #define THREAD_RETRY_DELAY_SECS (60) #define MAX_THREAD_RETRIES (10) -/* Control structure used for ipmitool related functions ; like sensor monitoring */ -#define DEFAULT_IPMITOOL_SENSOR_MONITORING_PERIOD_SECS (120) /* 2 minutes */ +#define BMC_JSON__SENSOR_DATA_MESSAGE_HEADER ((const char *)("bmc_sensor_data")) -#define IPMITOOL_JSON__SENSOR_DATA_MESSAGE_HEADER ((const char *)("ipmitool_sensor_data")) +#define BMC_JSON__SENSORS_LABEL ((const char *)("sensors")) +#define IPMITOOL_SENSOR_QUERY_CMD ((const char *)(" sensor list")) -#define IPMITOOL_JSON__SENSORS_LABEL ((const char *)("sensors")) -#define IPMITOOL_SENSOR_QUERY_CMD ((const char *)(" sensor list")) +#define BMC_SENSOR_OUTPUT_FILE_SUFFIX ((const char *)("_sensor_data")) -#define IPMITOOL_SENSOR_OUTPUT_FILE_SUFFIX ((const char *)("_sensor_data")) +/* TBD */ +#define REDFISHTOOL_READ_POWER_SENSORS_CMD ((const char *)("Chassis Power")) +#define REDFISHTOOL_READ_THERMAL_SENSORS_CMD ((const char *)("Chassis Thermal")) +#define REDFISHTOOL_POWER_STATUS_CMD ((const char *)(" ")) typedef struct { @@ -154,7 +179,7 @@ typedef struct char unc [IPMITOOL_MAX_FIELD_LEN] ; /* Upper Non-Critical */ char ucr [IPMITOOL_MAX_FIELD_LEN] ; /* Upper Critical */ char unr [IPMITOOL_MAX_FIELD_LEN] ; /* Upper Non-Recoverable */ -} ipmitool_sample_type ; +} bmc_sample_type ; typedef struct { @@ -162,9 +187,7 @@ typedef struct string bm_un ; string bm_pw ; - string sensor_query_request ; /**< sensor query system call request */ - int samples ; - + int samples ; } thread_extra_info_type ; #endif // __INCLUDE_HWMONTHREAD_HH__ diff --git a/mtce/src/hwmon/hwmonUtil.cpp b/mtce/src/hwmon/hwmonUtil.cpp index 9f539ea1..0150f8a9 100644 --- a/mtce/src/hwmon/hwmonUtil.cpp +++ b/mtce/src/hwmon/hwmonUtil.cpp @@ -92,7 +92,7 @@ sensor_severity_enum get_severity ( string status ) return HWMON_SEVERITY_OFFLINE ; } -string get_ipmi_severity ( sensor_severity_enum status ) +string get_bmc_severity ( sensor_severity_enum status ) { switch ( status ) { @@ -104,7 +104,7 @@ string get_ipmi_severity ( sensor_severity_enum status ) } } -sensor_severity_enum get_ipmi_severity ( string status ) +sensor_severity_enum get_bmc_severity ( string status ) { if ( status.compare("ok") == 0 ) return HWMON_SEVERITY_GOOD ; diff --git a/mtce/src/hwmon/hwmonUtil.h b/mtce/src/hwmon/hwmonUtil.h index cdf0abcb..3637ed67 100644 --- a/mtce/src/hwmon/hwmonUtil.h +++ b/mtce/src/hwmon/hwmonUtil.h @@ -28,8 +28,8 @@ void clear_asserted_alarm ( string & hostname, hwmonAlarm_id_type id, sensor_t string get_severity ( sensor_severity_enum severity ); sensor_severity_enum get_severity ( string status ); -string get_ipmi_severity ( sensor_severity_enum status ); -sensor_severity_enum get_ipmi_severity ( string status ); +string get_bmc_severity ( sensor_severity_enum status ); +sensor_severity_enum get_bmc_severity ( string status ); bool is_valid_action ( sensor_severity_enum severity, string & action, bool set_to_lower ); bool is_ignore_action ( string action ) ; diff --git a/mtce/src/maintenance/mtcBmcUtil.cpp b/mtce/src/maintenance/mtcBmcUtil.cpp index 1f79d376..a397d348 100644 --- a/mtce/src/maintenance/mtcBmcUtil.cpp +++ b/mtce/src/maintenance/mtcBmcUtil.cpp @@ -365,7 +365,7 @@ int nodeLinkClass::bmc_command_recv ( struct nodeLinkClass::node * node_ptr ) * * Name : bmc_command_done * - * Description: This utility frees the ipmitool command thread for next execution. + * Description: This utility frees the bmc command thread for next execution. * *****************************************************************************/ diff --git a/mtce/src/maintenance/mtcCmdHdlr.cpp b/mtce/src/maintenance/mtcCmdHdlr.cpp index 2e74dc20..e7be32e2 100644 --- a/mtce/src/maintenance/mtcCmdHdlr.cpp +++ b/mtce/src/maintenance/mtcCmdHdlr.cpp @@ -479,7 +479,7 @@ int nodeLinkClass::cmd_handler ( struct nodeLinkClass::node * node_ptr ) mtcInvApi_update_task ( node_ptr, MTC_TASK_RESET_REQUEST); } - /* bmc power control reset by ipmitool */ + /* bmc power control reset by bmc */ rc = bmc_command_send ( node_ptr, BMC_THREAD_CMD__POWER_RESET ); if ( rc == PASS ) @@ -518,7 +518,7 @@ int nodeLinkClass::cmd_handler ( struct nodeLinkClass::node * node_ptr ) { int delay = (((offline_period*offline_threshold)/1000)+3); - /* bmc power control reset by ipmitool */ + /* bmc power control reset by bmc */ rc = bmc_command_recv ( node_ptr ); if ( rc == RETRY ) { diff --git a/mtce/src/maintenance/mtcNodeHdlrs.cpp b/mtce/src/maintenance/mtcNodeHdlrs.cpp index e78ba397..714b4c28 100755 --- a/mtce/src/maintenance/mtcNodeHdlrs.cpp +++ b/mtce/src/maintenance/mtcNodeHdlrs.cpp @@ -4046,7 +4046,7 @@ int nodeLinkClass::reset_handler ( struct nodeLinkClass::node * node_ptr ) * BMC provisioned cases: * * BMC won't power on - * BMC ipmi command failure + * BMC command failure * BMC connectivity lost mid-FSM. * BMC access timeout * @@ -5106,7 +5106,7 @@ int nodeLinkClass::powercycle_handler ( struct nodeLinkClass::node * node_ptr ) /* TODO: RELEASE NOTE: Node may be left in the disabled state * - need to track power state and raise logs or alarms if host is stuck in power off state. - * - The ipmitool update does add tracking of the power state but does not introduce the alarm */ + * - The bmc update does add tracking of the power state but does not introduce the alarm */ // send_hwmon_command ( node_ptr->hostname, MTC_CMD_START_HOST ); @@ -6488,7 +6488,7 @@ int nodeLinkClass::bmc_handler ( struct nodeLinkClass::node * node_ptr ) } else if ( rc != PASS ) { - /* this error is reported by the ipmi receive driver */ + /* this error is reported by the bmc receive driver */ node_ptr->bmc_info_query_active = false ; node_ptr->bmc_thread_ctrl.done = true ; mtcTimer_start ( node_ptr->bm_timer, mtcTimer_handler, MTC_POWER_ACTION_RETRY_DELAY ); diff --git a/mtce/src/maintenance/mtcThreads.cpp b/mtce/src/maintenance/mtcThreads.cpp index 9e38f67f..ca7e85b5 100644 --- a/mtce/src/maintenance/mtcThreads.cpp +++ b/mtce/src/maintenance/mtcThreads.cpp @@ -460,9 +460,9 @@ void * mtcThread_bmc ( void * arg ) bypass_request = true ; rc = PASS ; } - else if ( daemon_want_fit ( FIT_CODE__AVOID_N_FAIL_IPMITOOL_REQUEST, info_ptr->hostname )) + else if ( daemon_want_fit ( FIT_CODE__AVOID_N_FAIL_BMC_REQUEST, info_ptr->hostname )) { - slog ("%s FIT FIT_CODE__AVOID_N_FAIL_IPMITOOL_REQUEST\n", info_ptr->hostname.c_str()); + slog ("%s FIT FIT_CODE__AVOID_N_FAIL_BMC_REQUEST\n", info_ptr->hostname.c_str()); bypass_request = true ; rc = FAIL_FIT ; }