Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
Signed-off-by: Ze Gan <ganze718@gmail.com>
  • Loading branch information
Pterosaur committed Oct 2, 2021
1 parent 48ab96c commit ab2f2fd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
18 changes: 18 additions & 0 deletions orchagent/orch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,24 @@ task_process_status Orch::handleSaiCreateStatus(sai_api_t api, sai_status_t stat
exit(EXIT_FAILURE);
}
break;
case SAI_API_HOSTIF:
switch (status)
{
case SAI_STATUS_SUCCESS:
return task_success;
case SAI_STATUS_FAILURE:
/*
* Host interface maybe failed due to lane not available.
* In some scenarios, like SONiC virtual machine, the invalid lane may be not enabled by VM configuration,
* So just ignore the failure and report an error log.
*/
SWSS_LOG_ERROR("Fail to create host interface %s", static_cast<const char *>(context));
return task_ignore;
default:
SWSS_LOG_ERROR("Encountered failure in create operation, exiting orchagent, SAI API: %s, status: %s",
sai_serialize_api(api).c_str(), sai_serialize_status(status).c_str());
exit(EXIT_FAILURE);
}
default:
switch (status)
{
Expand Down
7 changes: 2 additions & 5 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2747,10 +2747,7 @@ void PortsOrch::doPortTask(Consumer &consumer)

if (!initPort(get<0>(it->second), get<5>(it->second), get<4>(it->second), it->first))
{
SWSS_LOG_ERROR("Initialize port %s failure", get<0>(it->second).c_str());

it++;
continue;
throw runtime_error("PortsOrch initialization failure.");
}

initPortSupportedSpeeds(get<0>(it->second), m_portListLaneMap[it->first]);
Expand Down Expand Up @@ -4136,7 +4133,7 @@ bool PortsOrch::addHostIntfs(Port &port, string alias, sai_object_id_t &host_int
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to create host interface for port %s", alias.c_str());
task_process_status handle_status = handleSaiCreateStatus(SAI_API_HOSTIF, status);
task_process_status handle_status = handleSaiCreateStatus(SAI_API_HOSTIF, status, alias.c_str());
if (handle_status != task_success)
{
return parseHandleSaiStatusFailure(handle_status);
Expand Down

0 comments on commit ab2f2fd

Please sign in to comment.