Merge "Extend bmc secret timeout and randomize retry delay"
This commit is contained in:
commit
2d8b539d54
@ -2,7 +2,7 @@
|
|||||||
#define __INCLUDE_HTTPUTIL_H__
|
#define __INCLUDE_HTTPUTIL_H__
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2016, 2024 Wind River Systems, Inc.
|
* Copyright (c) 2013, 2016, 2024, 2025 Wind River Systems, Inc.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
@ -52,7 +52,7 @@ using namespace std;
|
|||||||
#define HTTP_KEYSTONE_GET_TIMEOUT (10)
|
#define HTTP_KEYSTONE_GET_TIMEOUT (10)
|
||||||
#define HTTP_SMGR_TIMEOUT (20)
|
#define HTTP_SMGR_TIMEOUT (20)
|
||||||
#define HTTP_VIM_TIMEOUT (20)
|
#define HTTP_VIM_TIMEOUT (20)
|
||||||
#define HTTP_SECRET_TIMEOUT (5)
|
#define HTTP_SECRET_TIMEOUT (20)
|
||||||
|
|
||||||
#define SMGR_MAX_RETRIES (3)
|
#define SMGR_MAX_RETRIES (3)
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Wind River Systems, Inc.
|
* Copyright (c) 2019,2025 Wind River Systems, Inc.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
@ -247,6 +247,9 @@ barbicanSecret_type * secretUtil_manage_secret ( libEvent & event,
|
|||||||
case MTC_SECRET__GET_REF_FAIL:
|
case MTC_SECRET__GET_REF_FAIL:
|
||||||
case MTC_SECRET__GET_PWD_FAIL:
|
case MTC_SECRET__GET_PWD_FAIL:
|
||||||
{
|
{
|
||||||
|
// Random number between 10 and 100 assuming SECRET_RETRY_DELAY is 10
|
||||||
|
// The 91 ensures the result is between 0 and 90
|
||||||
|
int random_retry_delay = (rand() % 91) + SECRET_RETRY_DELAY ;
|
||||||
if ( it->second.stage == MTC_SECRET__GET_REF_FAIL )
|
if ( it->second.stage == MTC_SECRET__GET_REF_FAIL )
|
||||||
{
|
{
|
||||||
wlog ( "%s failed to get secret reference \n", hostname.c_str() );
|
wlog ( "%s failed to get secret reference \n", hostname.c_str() );
|
||||||
@ -257,7 +260,8 @@ barbicanSecret_type * secretUtil_manage_secret ( libEvent & event,
|
|||||||
}
|
}
|
||||||
it->second.stage = MTC_SECRET__START ;
|
it->second.stage = MTC_SECRET__START ;
|
||||||
mtcTimer_reset ( secret_timer );
|
mtcTimer_reset ( secret_timer );
|
||||||
mtcTimer_start ( secret_timer, handler, SECRET_RETRY_DELAY );
|
mtcTimer_start ( secret_timer, handler, random_retry_delay );
|
||||||
|
ilog ("%s bmc secret query will retry in %d seconds", hostname.c_str(), random_retry_delay );
|
||||||
httpUtil_free_conn ( event );
|
httpUtil_free_conn ( event );
|
||||||
httpUtil_free_base ( event );
|
httpUtil_free_base ( event );
|
||||||
break ;
|
break ;
|
||||||
|
@ -133,9 +133,22 @@ void hwmonHostClass::hwmon_fsm ( void )
|
|||||||
|
|
||||||
if ( secret->stage == MTC_SECRET__GET_PWD_RECV )
|
if ( secret->stage == MTC_SECRET__GET_PWD_RECV )
|
||||||
{
|
{
|
||||||
host_ptr->bm_pw = host_ptr->thread_extra_info.bm_pw = secret->payload ;
|
/* Free the http connection and base resources */
|
||||||
ilog ("%s bmc credentials received",
|
httpUtil_free_conn ( host_ptr->secretEvent );
|
||||||
hostname.c_str());
|
httpUtil_free_base ( host_ptr->secretEvent );
|
||||||
|
|
||||||
|
if ( secret->payload.empty() )
|
||||||
|
{
|
||||||
|
wlog ("%s failed to acquire bmc password", hostname.c_str());
|
||||||
|
secret->stage = MTC_SECRET__GET_PWD_FAIL ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
host_ptr->bm_pw = host_ptr->thread_extra_info.bm_pw = secret->payload ;
|
||||||
|
ilog ("%s bmc credentials received", hostname.c_str());
|
||||||
|
/* put the FSM back to the start */
|
||||||
|
secret->stage = MTC_SECRET__START ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user