From 1902da1ce9e5f1b88ecc823d3ad4c222894500b2 Mon Sep 17 00:00:00 2001 From: Bin Qian Date: Tue, 9 Oct 2018 13:56:13 -0400 Subject: [PATCH] Remove code incorrectly listen sm-api commands The sm-api node-set command listener should not be overriden Story: 2003577 Task: 26404 Change-Id: I9a20989bd679744f2598389c71f923aa65a66084 Signed-off-by: Bin Qian --- service-mgmt/sm-1.0.0/src/sm_failover.c | 52 ------------------------- 1 file changed, 52 deletions(-) diff --git a/service-mgmt/sm-1.0.0/src/sm_failover.c b/service-mgmt/sm-1.0.0/src/sm_failover.c index 5e8e8f02..dc17cdd9 100644 --- a/service-mgmt/sm-1.0.0/src/sm_failover.c +++ b/service-mgmt/sm-1.0.0/src/sm_failover.c @@ -174,7 +174,6 @@ static bool _hello_msg_alive = true; static SmSystemModeT _system_mode; static time_t _last_report_ts = 0; static int _heartbeat_count = 0; -static bool _peer_ready = false; // The class is to accommodate batching i/f state changes // during the failover_audit interval. @@ -1437,39 +1436,6 @@ SmFailoverInterfaceStateT sm_failover_get_interface_info(SmInterfaceTypeT interf } // **************************************************************************** -static void sm_failover_node_set_callback( char node_name[], - SmNodeSetActionT action, SmNodeAdminStateT admin_state, - SmNodeOperationalStateT oper_state, SmNodeAvailStatusT avail_status, - int seqno ) -{ - if(0 == strcmp(node_name, _host_name)) - { - // care only the peer - return; - } - - bool peer_ready = false; - if(SM_NODE_SET_ACTION_UNLOCK == action) - { - peer_ready = SM_NODE_ADMIN_STATE_UNLOCKED == admin_state && - SM_NODE_OPERATIONAL_STATE_ENABLED == oper_state && - (SM_NODE_AVAIL_STATUS_AVAILABLE == avail_status || - SM_NODE_AVAIL_STATUS_DEGRADED == avail_status); - }else if (SM_NODE_SET_ACTION_LOCK == action) - { - peer_ready = false; - }else - { - return; - } - if(peer_ready && !_peer_ready) - { - DPRINTFI("Peer %s is now online.", node_name); - } - _peer_ready = peer_ready; -} - -static SmApiCallbacksT _api_callbacks = {0}; // **************************************************************************** // Failover - Initialize // ====================== @@ -1515,17 +1481,6 @@ SmErrorT sm_failover_initialize( void ) return error; } - _api_callbacks.node_set = sm_failover_node_set_callback; - - error = sm_api_register_callbacks( &_api_callbacks ); - if( SM_OKAY != error ) - { - DPRINTFE( "Failed to register api callbacks, error=%s.", - sm_error_str( error ) ); - return( error ); - } - - if( 0 == strcmp( SM_NODE_CONTROLLER_0_NAME, _host_name ) ) { snprintf( _peer_name, sizeof(_peer_name), "%s", SM_NODE_CONTROLLER_1_NAME ); @@ -1613,13 +1568,6 @@ SmErrorT sm_failover_finalize( void ) _total_interfaces = 0; SmErrorT error; - error = sm_api_deregister_callbacks( &_api_callbacks ); - if( SM_OKAY != error ) - { - DPRINTFE( "Failed to deregister api callbacks, error=%s.", - sm_error_str( error ) ); - } - sm_timer_deregister( failover_audit_timer_id ); if( NULL != _sm_db_handle ) {