diff --git a/orchagent/orch.cpp b/orchagent/orch.cpp index d970c83f07d3..226512f388e4 100644 --- a/orchagent/orch.cpp +++ b/orchagent/orch.cpp @@ -705,6 +705,23 @@ 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. + */ + 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) { diff --git a/orchagent/portsorch.cpp b/orchagent/portsorch.cpp index 68028e2c219d..a8bcef67c730 100755 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -2747,7 +2747,9 @@ void PortsOrch::doPortTask(Consumer &consumer) if (!initPort(get<0>(it->second), get<5>(it->second), get<4>(it->second), it->first)) { - throw runtime_error("PortsOrch initialization failure."); + // Failure has been recorded in initPort + it++; + continue; } initPortSupportedSpeeds(get<0>(it->second), m_portListLaneMap[it->first]);