Merge "Deprovision mtcClient bmc info when bmc for node is deprovisioned"

This commit is contained in:
Zuul 2024-06-10 16:37:24 +00:00 committed by Gerrit Code Review
commit dbb9543c08
2 changed files with 29 additions and 29 deletions

View File

@ -506,27 +506,23 @@ int mtc_service_inbox ( nodeLinkClass * obj_ptr,
}
obj_ptr->declare_service_ready ( hostname, MTC_SERVICE_MTCCLIENT, features );
/* if this ready event is from the mtcClient of a
* controller that has valid bmc access info then
* build the 'peer controller kill' mtcInfo and
* send it to that mtcClient */
if ( obj_ptr->get_nodetype ( hostname ) & CONTROLLER_TYPE )
/* The mtcInfo in this context currently only contains
* bmc provisioning info for the purpose of telling
* the mtcClient what its peer bmc priovisioning data is.
*
* No need to send this on an SX system as there
* is no peer controller.
*
* The network check avoids sending duplicate on
* the pxeboot network.
*
* Only applies to mtcClients that run on controllers */
if (( iface == MGMNT_INTERFACE ) &&
( obj_ptr->system_type != SYSTEM_TYPE__AIO__SIMPLEX ) &&
( obj_ptr->get_nodetype ( hostname ) & CONTROLLER_TYPE ))
{
string bm_pw = obj_ptr->get_bm_pw ( hostname ) ;
if ( !bm_pw.empty() && ( bm_pw != NONE ))
{
string bm_un = obj_ptr->get_bm_un ( hostname ) ;
string bm_ip = obj_ptr->get_bm_ip ( hostname ) ;
if (( hostUtil_is_valid_username ( bm_un )) &&
( hostUtil_is_valid_ip_addr ( bm_ip )))
{
send_mtc_cmd ( hostname,
MTC_MSG_INFO,
MGMNT_INTERFACE,
obj_ptr->build_mtcInfo_dict (
MTC_INFO_CODE__PEER_CONTROLLER_KILL_INFO));
}
}
send_mtc_cmd ( hostname, MTC_MSG_INFO, MGMNT_INTERFACE,
obj_ptr->build_mtcInfo_dict ( MTC_INFO_CODE__PEER_CONTROLLER_KILL_INFO));
}
return (PASS);
}

View File

@ -2459,16 +2459,20 @@ void load_mtcInfo_msg ( mtc_message_type & msg )
peer_controller.bm_un = jsonUtil_get_key_value_string(ctrl_obj, "bm_un");
peer_controller.bm_pw = jsonUtil_get_key_value_string(ctrl_obj, "bm_pw");
/* log the mc info but not the bmc password ; only
* indicate that it looks 'ok' or 'is 'none' */
ilog ("%s is my peer [host:%s bmc:%s:%s:%s]",
peer_controller.hostname.c_str(),
peer_controller.host_ip.c_str(),
peer_controller.bm_ip.c_str(),
peer_controller.bm_un.c_str(),
hostUtil_is_valid_pw(peer_controller.bm_pw) ? "ok":"none");
/* Log the mc info but not the bmc password.
* Only indicate that it looks 'ok' or 'is 'none'.
* However, don't log if the bmc ip is none */
if ( peer_controller.bm_ip.compare("none") )
{
ilog ("%s is my peer [host:%s bmc:%s:%s:%s]",
peer_controller.hostname.c_str(),
peer_controller.host_ip.c_str(),
peer_controller.bm_ip.c_str(),
peer_controller.bm_un.c_str(),
hostUtil_is_valid_pw(peer_controller.bm_pw) ? "ok":"none");
}
}
else
else if ( ctrl.system_type != SYSTEM_TYPE__AIO__SIMPLEX )
{
wlog("peer mtcInfo missing (rc:%d) ; %s",
json_rc, &msg.buf[0]);