Prevent maintenance setup of the pxeboot network on simplex systems

The pxeboot network is used to install system nodes.
However, simplex systems do not have system nodes.
Therefore, the pxeboot network setup is not needed on SX systems.

This update implements changes to Maintenance, specifically the
mtcAgent and mtcClient processes, to not setup and service messaging
on the pxeboot network on simplex systems.

Test Plan:

PASS: Verify before and after update behavior
PASS: Verify Build, install and enable AIO SX
PASS: Verify the pxeboot network is not setup on SX systems
PASS: Verify pxeboot messaging and alarming works on DX systems
PASS: Verify install and enable DX systems with no pxeboot alarms
PASS: Verify mtcAgent and mtcClient logging
PASS: Verify SX to DX Migration

Closes-Bug: 2073292
Change-Id: I0e3749bab29d88917f36bc29e8b775dfd5e8a13f
Signed-off-by: Eric MacDonald <eric.macdonald@windriver.com>
This commit is contained in:
Eric MacDonald 2024-07-16 21:50:25 +00:00
parent 13df7262c0
commit fb36d3b810
2 changed files with 72 additions and 28 deletions

View File

@ -659,8 +659,11 @@ int mtc_socket_init ( void )
/************************************************************/
/* Setup Pxeboot Network messaging sockets to/from mtcAgent */
/************************************************************/
setup_pxeboot_rx_socket ();
setup_pxeboot_tx_socket ();
if ( ctrl.pxeboot_iface_provisioned )
{
setup_pxeboot_rx_socket ();
setup_pxeboot_tx_socket ();
}
/* Manage Cluster-host network setup */
string mgmnt_iface_name = daemon_mgmnt_iface();
@ -1305,7 +1308,14 @@ int daemon_init ( string iface, string nodetype_str )
// equal to the management interface, until otherwise updated due
// to bonding or vlan modes.
ctrl.pxeboot_iface = ctrl.mgmnt_iface ;
ctrl.pxeboot_iface_provisioned = true ;
if ( ctrl.system_type != SYSTEM_TYPE__AIO__SIMPLEX )
{
ctrl.pxeboot_iface_provisioned = true ;
}
else
{
ilog ("Simplex Mode: Pxeboot network not provisioned");
}
}
}
if ( daemon_files_init () != PASS )
@ -1336,9 +1346,12 @@ int daemon_init ( string iface, string nodetype_str )
rc = FAIL_NODETYPE;
}
if (( rc = learn_my_pxeboot_address () ) != PASS )
if ( ctrl.system_type != SYSTEM_TYPE__AIO__SIMPLEX )
{
wlog ("failed to learn my pxeboot address ; rc:%d", rc );
if (( rc = learn_my_pxeboot_address () ) != PASS )
{
wlog ("failed to learn my pxeboot address ; rc:%d", rc );
}
}
/* Setup the heartbeat service messaging sockets */
@ -1487,7 +1500,8 @@ void daemon_service_run ( void )
FD_SET(mtc_sock.mtc_client_clstr_rx_socket->getFD(), &mtc_sock.readfds);
}
if ( mtc_sock.pxeboot_rx_socket )
if (( ctrl.pxeboot_iface_provisioned ) &&
( mtc_sock.pxeboot_rx_socket ))
{
socks.push_front (mtc_sock.pxeboot_rx_socket);
FD_SET(mtc_sock.pxeboot_rx_socket, &mtc_sock.readfds);
@ -1522,9 +1536,11 @@ void daemon_service_run ( void )
}
else
{
// Is there a Pxeboot network message present ?
if (mtc_sock.pxeboot_rx_socket &&
FD_ISSET(mtc_sock.pxeboot_rx_socket, &mtc_sock.readfds))
if (( ctrl.pxeboot_iface_provisioned ) &&
( mtc_sock.pxeboot_rx_socket ) &&
( FD_ISSET(mtc_sock.pxeboot_rx_socket, &mtc_sock.readfds)))
{
mlog3 ("pxeboot rx socket fired");
mtc_service_command ( sock_ptr, PXEBOOT_INTERFACE );
@ -1759,9 +1775,12 @@ void daemon_service_run ( void )
if ( socket_reinit )
{
if (( mtc_sock.pxeboot_tx_socket <= 0 ) || ( mtc_sock.pxeboot_rx_socket <= 0 ))
if (( ctrl.pxeboot_iface_provisioned ) &&
(( mtc_sock.pxeboot_tx_socket <= 0 ) ||
( mtc_sock.pxeboot_rx_socket <= 0 )))
{
learn_my_pxeboot_address ();
}
/* re-get identity if interfaces are re-initialized */
string who_i_am = _self_identify ( ctrl.nodetype_str );
}
@ -1771,7 +1790,10 @@ void daemon_service_run ( void )
if ( ! daemon_want_fit ( FIT_CODE__FAIL_PXEBOOT_MTCALIVE ) )
#endif
{
send_mtcAlive_msg ( sock_ptr, ctrl.who_i_am, PXEBOOT_INTERFACE );
if ( ctrl.pxeboot_iface_provisioned )
{
send_mtcAlive_msg ( sock_ptr, ctrl.who_i_am, PXEBOOT_INTERFACE );
}
}
send_mtcAlive_msg ( sock_ptr, ctrl.who_i_am, MGMNT_INTERFACE );
if (( ctrl.clstr_iface_provisioned == true ) &&
@ -1788,12 +1810,14 @@ void daemon_service_run ( void )
if ( daemon_is_file_present ( MTC_CMD_FIT__DIR ) )
{
/* fault insertion testing */
if ( daemon_is_file_present ( MTC_CMD_FIT__PXEBOOT_RXSOCK ))
_close_pxeboot_rx_socket();
if ( daemon_is_file_present ( MTC_CMD_FIT__PXEBOOT_TXSOCK ))
_close_pxeboot_tx_socket ();
if ( ctrl.pxeboot_iface_provisioned )
{
/* fault insertion testing */
if ( daemon_is_file_present ( MTC_CMD_FIT__PXEBOOT_RXSOCK ))
_close_pxeboot_rx_socket();
if ( daemon_is_file_present ( MTC_CMD_FIT__PXEBOOT_TXSOCK ))
_close_pxeboot_tx_socket ();
}
/* fault insertion testing */
if ( daemon_is_file_present ( MTC_CMD_FIT__MGMNT_RXSOCK ))
{
@ -1901,7 +1925,10 @@ void daemon_service_run ( void )
slog ("mtcAlive Stress Test: Sending %d mtcAlive on each network.", loops);
for ( int loop = 0 ; loop < loops ; loop++ )
{
send_mtcAlive_msg ( sock_ptr, ctrl.who_i_am, PXEBOOT_INTERFACE );
if ( ctrl.pxeboot_iface_provisioned )
{
send_mtcAlive_msg ( sock_ptr, ctrl.who_i_am, PXEBOOT_INTERFACE );
}
send_mtcAlive_msg ( sock_ptr, ctrl.who_i_am, MGMNT_INTERFACE );
send_mtcAlive_msg ( sock_ptr, ctrl.who_i_am, CLSTR_INTERFACE );

View File

@ -249,8 +249,11 @@ static void mtc_socket_fini(void)
set_inotify_close(mtcInv.inotify_shadow_file_fd,
mtcInv.inotify_shadow_file_wd);
pxeboot_tx_socket_close();
pxeboot_rx_socket_close();
if ( mtcInv.pxeboot_network_provisioned )
{
pxeboot_tx_socket_close();
pxeboot_rx_socket_close();
}
mtc_agent_clstr_tx_socket_close();
mtc_agent_clstr_rx_socket_close();
mtc_agent_mgmt_tx_socket_close();
@ -1469,7 +1472,12 @@ void daemon_service_run ( void )
get_iface_macaddr ( mtc_config.mgmnt_iface , my_mac );
dlog ("Mgmt IF mac: %s", my_mac.c_str());
mtcInv.my_pxeboot_if = daemon_mgmnt_iface() ;
if (( mtcInv.my_pxeboot_if != LOOPBACK_IF ) && ( !my_mac.empty() ))
if ( mtcInv.system_type == SYSTEM_TYPE__AIO__SIMPLEX )
{
ilog ("Simplex Mode: Pxeboot network not provisioned");
}
else if (( mtcInv.my_pxeboot_if != LOOPBACK_IF ) && ( !my_mac.empty()))
{
mtcInv.pxeboot_network_provisioned = true ;
mtc_config.pxeboot_iface = daemon_get_iface_master ((char*)mtcInv.my_pxeboot_if.data());
@ -1593,9 +1601,14 @@ void daemon_service_run ( void )
// service_events
socks.push_front (mtc_sock.mtc_event_rx_sock->getFD());
// mtc_service_inbox - receive sockets from Pxeboot, Mgmt and Clstr network
if ( mtc_sock.pxeboot_rx_socket )
socks.push_front (mtc_sock.pxeboot_rx_socket);
if ( mtcInv.pxeboot_network_provisioned )
{
// mtc_service_inbox - receive sockets from Pxeboot, Mgmt and Clstr network
if ( mtc_sock.pxeboot_rx_socket )
{
socks.push_front (mtc_sock.pxeboot_rx_socket);
}
}
socks.push_front (mtc_sock.mtc_agent_mgmt_rx_socket->getFD());
if ( mtcInv.clstr_network_provisioned == true )
{
@ -1769,10 +1782,13 @@ void daemon_service_run ( void )
{
FD_SET(mtc_sock.mtc_agent_clstr_rx_socket->getFD(),&mtc_sock.readfds);
}
// Listen to the pxeboot rx socket if it is setup
if ( mtc_sock.pxeboot_rx_socket > 0 )
if ( mtcInv.pxeboot_network_provisioned == true )
{
FD_SET(mtc_sock.pxeboot_rx_socket, &mtc_sock.readfds);
// Listen to the pxeboot rx socket if it is setup
if ( mtc_sock.pxeboot_rx_socket > 0 )
{
FD_SET(mtc_sock.pxeboot_rx_socket, &mtc_sock.readfds);
}
}
if ( mtce_event.fd )
{
@ -1838,7 +1854,8 @@ void daemon_service_run ( void )
mlog3 ("events handling done");
}
if ( mtc_sock.pxeboot_rx_socket && FD_ISSET(mtc_sock.pxeboot_rx_socket, &mtc_sock.readfds))
if (( mtcInv.pxeboot_network_provisioned == true ) &&
( mtc_sock.pxeboot_rx_socket && FD_ISSET(mtc_sock.pxeboot_rx_socket, &mtc_sock.readfds)))
{
int cnt = 0 ;
/* Service up to MAX_RX_MSG_BATCH of messages at once */