Support mgmt and infra network on an interface
Currently, management interface can be shared with infrastructure only over an VLAN. This update supports both management and infrastructure network sharing a single interface. Story: 2003087 Task: 23171 Depends-On: https://review.openstack.org/#/c/601156 Change-Id: Ie97dbd1260f5c98d7401b0e48361ebd87f060f65 Signed-off-by: Teresa Ho <teresa.ho@windriver.com>
This commit is contained in:
parent
a2dc830d33
commit
eb7559f335
@ -268,9 +268,15 @@ int msgClassAddr::getAddressFromInterface(const char* interface, char* address,
|
||||
get_infra_iface(&infra_iface_name);
|
||||
if (infra_iface_name && strlen(infra_iface_name)) {
|
||||
if (!strcmp(interface, infra_iface_name)) {
|
||||
if (!strcmp(infra_iface_name, daemon_mgmnt_iface().data())) {
|
||||
// infra and mgmt interface name are the same
|
||||
interface_type = MGMNT_IFACE;
|
||||
}
|
||||
else {
|
||||
// requesting address for the infra interface
|
||||
interface_type = INFRA_IFACE;
|
||||
}
|
||||
}
|
||||
free (infra_iface_name);
|
||||
}
|
||||
|
||||
|
7
mtce-common/cgts-mtce-common-1.0/heartbeat/hbsAgent.cpp
Executable file → Normal file
7
mtce-common/cgts-mtce-common-1.0/heartbeat/hbsAgent.cpp
Executable file → Normal file
@ -392,10 +392,17 @@ int daemon_configure ( void )
|
||||
* aggrigated name is returned if it exists */
|
||||
get_infra_iface (&hbs_config.infra_iface );
|
||||
if ( strlen(hbs_config.infra_iface) )
|
||||
{
|
||||
if (!strcmp(hbs_config.infra_iface, hbs_config.mgmnt_iface))
|
||||
{
|
||||
hbsInv.infra_network_provisioned = false ;
|
||||
}
|
||||
else
|
||||
{
|
||||
hbsInv.infra_network_provisioned = true ;
|
||||
ilog ("Infra iface : %s\n", hbs_config.infra_iface );
|
||||
}
|
||||
}
|
||||
|
||||
ilog("Infra RxPort: %d\n", hbs_config.hbs_agent_infra_port );
|
||||
ilog("Infra TxPort: %d\n", hbs_config.hbs_client_infra_port );
|
||||
|
3
mtce-common/cgts-mtce-common-1.0/heartbeat/hbsClient.cpp
Executable file → Normal file
3
mtce-common/cgts-mtce-common-1.0/heartbeat/hbsClient.cpp
Executable file → Normal file
@ -417,10 +417,13 @@ int daemon_configure ( void )
|
||||
* aggrigated name is returned if it exists */
|
||||
get_infra_iface (&hbs_config.infra_iface );
|
||||
if ( strlen(hbs_config.infra_iface) )
|
||||
{
|
||||
if (strcmp(hbs_config.infra_iface, hbs_config.mgmnt_iface))
|
||||
{
|
||||
infra_network_provisioned = true ;
|
||||
ilog ("Infra iface : %s\n", hbs_config.infra_iface );
|
||||
}
|
||||
}
|
||||
ilog("Infra RxPort: %d\n", hbs_config.hbs_client_infra_port );
|
||||
ilog("Infra TxPort: %d\n", hbs_config.hbs_agent_infra_port );
|
||||
|
||||
|
72
mtce-common/cgts-mtce-common-1.0/maintenance/mtcNodeComp.cpp
Executable file → Normal file
72
mtce-common/cgts-mtce-common-1.0/maintenance/mtcNodeComp.cpp
Executable file → Normal file
@ -333,6 +333,11 @@ void setup_mgmnt_rx_socket ( void )
|
||||
|
||||
void setup_infra_rx_socket ( void )
|
||||
{
|
||||
if ( ctrl.infra_iface_provisioned == false )
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
dlog ("setup of infra RX\n");
|
||||
/* Fetch the infrastructure interface name.
|
||||
* calls daemon_get_iface_master inside so the
|
||||
@ -343,7 +348,6 @@ void setup_infra_rx_socket ( void )
|
||||
/* Only get the infrastructure network address if it is provisioned */
|
||||
if ( get_iface_address ( mtc_config.infra_iface, ctrl.address_infra, false ) == PASS )
|
||||
{
|
||||
ctrl.infra_iface_provisioned = true ;
|
||||
ilog ("Infra iface : %s\n", mtc_config.infra_iface );
|
||||
ilog ("Infra addr : %s\n", ctrl.address_infra.c_str());
|
||||
}
|
||||
@ -403,12 +407,12 @@ void setup_mgmnt_tx_socket ( void )
|
||||
|
||||
void setup_infra_tx_socket ( void )
|
||||
{
|
||||
ilog ("setup of infra TX\n");
|
||||
if ( ctrl.infra_iface_provisioned == false )
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
dlog ("setup of infra TX\n");
|
||||
_close_infra_tx_socket ();
|
||||
mtc_sock.mtc_client_infra_tx_socket = new msgClassTx(CONTROLLER_NFS,mtc_sock.mtc_agent_port, IPPROTO_UDP, mtc_config.infra_iface);
|
||||
|
||||
@ -522,20 +526,30 @@ int mtc_socket_init ( void )
|
||||
/************************************************************/
|
||||
setup_mgmnt_rx_socket ();
|
||||
|
||||
/************************************************************/
|
||||
/* Setup the Infra Interface Receive Socket */
|
||||
/************************************************************/
|
||||
setup_infra_rx_socket () ;
|
||||
|
||||
/************************************************************/
|
||||
/* Setup the Mgmnt Interface Transmit messaging to mtcAgent */
|
||||
/************************************************************/
|
||||
setup_mgmnt_tx_socket ();
|
||||
|
||||
/* Manage Infrastructure network setup */
|
||||
string infra_iface_name = daemon_infra_iface();
|
||||
string mgmnt_iface_name = daemon_mgmnt_iface();
|
||||
if ( !infra_iface_name.empty() )
|
||||
{
|
||||
if ( infra_iface_name != mgmnt_iface_name )
|
||||
{
|
||||
ctrl.infra_iface_provisioned = true ;
|
||||
/************************************************************/
|
||||
/* Setup the Infra Interface Receive Socket */
|
||||
/************************************************************/
|
||||
setup_infra_rx_socket () ;
|
||||
|
||||
/*************************************************************/
|
||||
/* Setup the Infra Interface Transmit Messaging to mtcAgent */
|
||||
/*************************************************************/
|
||||
setup_infra_tx_socket () ;
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************/
|
||||
/* Setup and Open the active monitoring socket */
|
||||
@ -1048,7 +1062,6 @@ void daemon_service_run ( void )
|
||||
string resource_name;
|
||||
|
||||
int rc = PASS ;
|
||||
int infra_retry_count = 0 ;
|
||||
int file_not_present_count = 0 ;
|
||||
|
||||
/* Start mtcAlive message timer */
|
||||
@ -1074,14 +1087,13 @@ void daemon_service_run ( void )
|
||||
FD_SET(mtc_sock.mtc_client_rx_socket->getFD(), &mtc_sock.readfds);
|
||||
}
|
||||
|
||||
if ( !ctrl.address_infra.empty() )
|
||||
{
|
||||
if ( mtc_sock.mtc_client_infra_rx_socket && mtc_sock.mtc_client_infra_rx_socket->return_status==PASS )
|
||||
if (( ctrl.infra_iface_provisioned == true ) &&
|
||||
( mtc_sock.mtc_client_infra_rx_socket ) &&
|
||||
( mtc_sock.mtc_client_infra_rx_socket->return_status==PASS ))
|
||||
{
|
||||
socks.push_front (mtc_sock.mtc_client_infra_rx_socket->getFD());
|
||||
FD_SET(mtc_sock.mtc_client_infra_rx_socket->getFD(), &mtc_sock.readfds);
|
||||
}
|
||||
}
|
||||
|
||||
mtc_sock.amon_socket = active_monitor_get_sel_obj ();
|
||||
if ( mtc_sock.amon_socket )
|
||||
@ -1133,13 +1145,14 @@ void daemon_service_run ( void )
|
||||
{
|
||||
mtc_service_command ( sock_ptr, MGMNT_INTERFACE );
|
||||
}
|
||||
if ((mtc_sock.mtc_client_infra_rx_socket && mtc_sock.mtc_client_infra_rx_socket->return_status==PASS) && FD_ISSET(mtc_sock.mtc_client_infra_rx_socket->getFD(), &mtc_sock.readfds))
|
||||
{
|
||||
if ( !ctrl.address_infra.empty() )
|
||||
if (( ctrl.infra_iface_provisioned == true ) &&
|
||||
( !ctrl.address_infra.empty() ) &&
|
||||
( mtc_sock.mtc_client_infra_rx_socket ) &&
|
||||
( mtc_sock.mtc_client_infra_rx_socket->return_status==PASS) &&
|
||||
( FD_ISSET(mtc_sock.mtc_client_infra_rx_socket->getFD(), &mtc_sock.readfds)))
|
||||
{
|
||||
mtc_service_command ( sock_ptr, INFRA_INTERFACE );
|
||||
}
|
||||
}
|
||||
if ( FD_ISSET(mtc_sock.amon_socket, &mtc_sock.readfds))
|
||||
{
|
||||
dlog3 ("Active Monitor Select Fired\n");
|
||||
@ -1181,26 +1194,6 @@ void daemon_service_run ( void )
|
||||
}
|
||||
}
|
||||
|
||||
/* retry getting the infra ip address if its not already provisioned */
|
||||
if ( ctrl.infra_iface_provisioned == false )
|
||||
{
|
||||
if ( infra_retry_count++ > 100 )
|
||||
{
|
||||
if ( strlen(mtc_config.infra_iface) )
|
||||
{
|
||||
ilog ("Retrying Interface %s\n", mtc_config.infra_iface )
|
||||
/* Only get the infrastructure network address if it is provisioned */
|
||||
rc = get_iface_address ( mtc_config.infra_iface, ctrl.address_infra, false );
|
||||
if ( rc == PASS )
|
||||
{
|
||||
ctrl.infra_iface_provisioned = true ;
|
||||
}
|
||||
}
|
||||
infra_retry_count = 0 ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (( ctrl.active_script_set == GOENABLED_MAIN_SCRIPTS ) ||
|
||||
( ctrl.active_script_set == GOENABLED_SUBF_SCRIPTS ))
|
||||
{
|
||||
@ -1385,11 +1378,18 @@ void daemon_service_run ( void )
|
||||
}
|
||||
|
||||
send_mtcAlive_msg ( sock_ptr, ctrl.who_i_am, MGMNT_INTERFACE );
|
||||
if (( ctrl.infra_iface_provisioned == true ) &&
|
||||
( mtc_sock.mtc_client_infra_rx_socket != NULL ) &&
|
||||
( mtc_sock.mtc_client_infra_rx_socket->sock_ok() == true ))
|
||||
{
|
||||
send_mtcAlive_msg ( sock_ptr, ctrl.who_i_am, INFRA_INTERFACE );
|
||||
}
|
||||
|
||||
/* Re-Start mtcAlive message timer */
|
||||
mtcTimer_start ( ctrl.timer, timer_handler, MTC_ALIVE_TIMER );
|
||||
|
||||
dlog3 ("Infra is %senabled", ctrl.infra_iface_provisioned ? "" : "NOT ");
|
||||
|
||||
if ( daemon_is_file_present ( MTC_CMD_FIT__DIR ) )
|
||||
{
|
||||
/* fault insertion testing */
|
||||
|
7
mtce-common/cgts-mtce-common-1.0/maintenance/mtcNodeCtrl.cpp
Executable file → Normal file
7
mtce-common/cgts-mtce-common-1.0/maintenance/mtcNodeCtrl.cpp
Executable file → Normal file
@ -610,8 +610,15 @@ int daemon_configure ( void )
|
||||
ilog ("Infra iface : %s\n", mtc_config.infra_iface );
|
||||
ilog ("Infra addr : %s\n", infra_ip.c_str());
|
||||
}
|
||||
if (!strcmp(mtc_config.infra_iface, mtc_config.mgmnt_iface))
|
||||
{
|
||||
mtcInv.infra_network_provisioned = false ;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtcInv.infra_network_provisioned = true ;
|
||||
}
|
||||
}
|
||||
|
||||
/* Log the startup settings */
|
||||
ilog("Cmd Req Port: %d (tx)\n", mtc_config.cmd_port );
|
||||
|
Loading…
Reference in New Issue
Block a user