Refresh DB session after swact in fm-subagent
After running a swact command, the snmp pod crashed and generated a coredump. That behavior was due to an invalid reference for the DB handler. This change adds a new function to renew the session after the first failure (this happens after swact) in the connection. During the retries, the session in renewed and the reference is restored. So the coredump is now avoided. Test plan PASS: * Deploy a multinode configuration (e.g. AIO-DX). * Install the SNMP application. * Perform a snmpget/snmpwalk/snmpbulk operation related to FM, to the floating IP, e.g. WRS-ALARM-MIB::wrsAlarmActiveAlarmId.1 * Perform a swact operation. * Repeat the snmp operation. * Both operations succeed and no coredumps are found in the filesystem of all controllers. Closes-bug: 2015408 Signed-off-by: Agustin Carranza <agustin.carranza@windriver.com> Change-Id: Idf5e8717c4f9605a3a7c1eaee1eb87e38bc305e4
This commit is contained in:
parent
a370f0d288
commit
8a6171fce0
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Wind River Systems, Inc.
|
||||
* Copyright (c) 2020-2023 Wind River Systems, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@ -75,6 +75,7 @@ Alarm_Scan_Init()
|
||||
DEBUGMSG(("cgtsAgentPlugin",
|
||||
"get_all_alarms returns false (%zu/%d). Try again\n",
|
||||
(i+1), retryCount));
|
||||
renewAlarmSession();
|
||||
}
|
||||
}
|
||||
if (!isAlarmObtained) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Wind River Systems, Inc.
|
||||
* Copyright (c) 2020-2023 Wind River Systems, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@ -123,6 +123,15 @@ TFmAlarmSessionT getAlarmSession()
|
||||
return alm_handle;
|
||||
}
|
||||
|
||||
void
|
||||
renewAlarmSession(void)
|
||||
{
|
||||
fm_snmp_util_destroy_session(alm_handle);
|
||||
if (fm_snmp_util_create_session(&alm_handle, NULL) != true){
|
||||
snmp_log(LOG_ERR,"failed to renew alarm database handler\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* our initialization routine, automatically called by the agent
|
||||
* (to get called, the function name must match init_FILENAME())
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Wind River Systems, Inc.
|
||||
* Copyright (c) 2020-2023 Wind River Systems, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@ -62,6 +62,7 @@ extern "C" {
|
||||
void init_snmpAgentPlugin(void);
|
||||
void deinit_snmpAgentPlugin(void);
|
||||
TFmAlarmSessionT getAlarmSession();
|
||||
void renewAlarmSession(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Wind River Systems, Inc.
|
||||
* Copyright (c) 2020-2023 Wind River Systems, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@ -75,6 +75,7 @@ Event_Log_Scan_Init()
|
||||
DEBUGMSG(("cgtsAgentPlugin",
|
||||
"get_all_event_logs returns false (%zu/%d). Try again\n",
|
||||
(i+1), retryCount));
|
||||
renewAlarmSession();
|
||||
}
|
||||
}
|
||||
if (!isEventObtained) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user