Skip to content

Commit

Permalink
[orchagent]: Remove unnecessary \n and suppress retry logs (sonic-net…
Browse files Browse the repository at this point in the history
  • Loading branch information
Shuotian Cheng authored and kcudnik committed May 31, 2017
1 parent 83e46ba commit f9d9f18
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 49 deletions.
52 changes: 26 additions & 26 deletions orchagent/bufferorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ task_process_status BufferOrch::processBufferPool(Consumer &consumer)
}
else
{
SWSS_LOG_ERROR("Unknown pool type specified:%s\n", type.c_str());
SWSS_LOG_ERROR("Unknown pool type specified:%s", type.c_str());
return task_process_status::task_invalid_entry;
}
attr.id = SAI_BUFFER_POOL_ATTR_TYPE;
Expand All @@ -104,15 +104,15 @@ task_process_status BufferOrch::processBufferPool(Consumer &consumer)
}
else
{
SWSS_LOG_ERROR("Unknown pool mode specified:%s\n", mode.c_str());
SWSS_LOG_ERROR("Unknown pool mode specified:%s", mode.c_str());
return task_process_status::task_invalid_entry;
}
attr.id = SAI_BUFFER_POOL_ATTR_TH_MODE;
attribs.push_back(attr);
}
else
{
SWSS_LOG_ERROR("Unknown pool field specified:%s, ignoring\n", fvField(*i).c_str());
SWSS_LOG_ERROR("Unknown pool field specified:%s, ignoring", fvField(*i).c_str());
continue;
}
}
Expand Down Expand Up @@ -153,7 +153,7 @@ task_process_status BufferOrch::processBufferPool(Consumer &consumer)
}
else
{
SWSS_LOG_ERROR("Unknown operation type %s\n", op.c_str());
SWSS_LOG_ERROR("Unknown operation type %s", op.c_str());
return task_process_status::task_invalid_entry;
}
return task_process_status::task_success;
Expand Down Expand Up @@ -192,10 +192,10 @@ task_process_status BufferOrch::processBufferProfile(Consumer &consumer)
{
if(ref_resolve_status::not_resolved == resolve_result)
{
SWSS_LOG_WARN("Missing or invalid pool reference specified\n");
SWSS_LOG_WARN("Missing or invalid pool reference specified");
return task_process_status::task_need_retry;
}
SWSS_LOG_ERROR("Resolving pool reference failed\n");
SWSS_LOG_ERROR("Resolving pool reference failed");
return task_process_status::task_failed;
}
attr.id = SAI_BUFFER_PROFILE_ATTR_POOL_ID;
Expand Down Expand Up @@ -234,7 +234,7 @@ task_process_status BufferOrch::processBufferProfile(Consumer &consumer)
}
else
{
SWSS_LOG_ERROR("Unknown buffer profile field specified:%s, ignoring\n", fvField(*i).c_str());
SWSS_LOG_ERROR("Unknown buffer profile field specified:%s, ignoring", fvField(*i).c_str());
continue;
}
}
Expand Down Expand Up @@ -274,7 +274,7 @@ task_process_status BufferOrch::processBufferProfile(Consumer &consumer)
}
else
{
SWSS_LOG_ERROR("Unknown operation type %s\n", op.c_str());
SWSS_LOG_ERROR("Unknown operation type %s", op.c_str());
return task_process_status::task_invalid_entry;
}
return task_process_status::task_success;
Expand All @@ -298,7 +298,7 @@ task_process_status BufferOrch::processQueue(Consumer &consumer)
tokens = tokenize(key, delimiter);
if (tokens.size() != 2)
{
SWSS_LOG_ERROR("malformed key:%s. Must contain 2 tokens\n", key.c_str());
SWSS_LOG_ERROR("malformed key:%s. Must contain 2 tokens", key.c_str());
return task_process_status::task_invalid_entry;
}
vector<string> port_names = tokenize(tokens[0], list_item_delimiter);
Expand All @@ -311,10 +311,10 @@ task_process_status BufferOrch::processQueue(Consumer &consumer)
{
if(ref_resolve_status::not_resolved == resolve_result)
{
SWSS_LOG_WARN("Missing or invalid queue buffer profile reference specified\n");
SWSS_LOG_WARN("Missing or invalid queue buffer profile reference specified");
return task_process_status::task_need_retry;
}
SWSS_LOG_ERROR("Resolving queue profile reference failed\n");
SWSS_LOG_ERROR("Resolving queue profile reference failed");
return task_process_status::task_failed;
}
sai_attribute_t attr;
Expand All @@ -326,7 +326,7 @@ task_process_status BufferOrch::processQueue(Consumer &consumer)
SWSS_LOG_DEBUG("processing port:%s", port_name.c_str());
if (!gPortsOrch->getPort(port_name, port))
{
SWSS_LOG_ERROR("Port with alias:%s not found\n", port_name.c_str());
SWSS_LOG_ERROR("Port with alias:%s not found", port_name.c_str());
return task_process_status::task_invalid_entry;
}
for (size_t ind = range_low; ind <= range_high; ind++)
Expand Down Expand Up @@ -369,7 +369,7 @@ task_process_status BufferOrch::processPriorityGroup(Consumer &consumer)
tokens = tokenize(key, delimiter);
if (tokens.size() != 2)
{
SWSS_LOG_ERROR("malformed key:%s. Must contain 2 tokens\n", key.c_str());
SWSS_LOG_ERROR("malformed key:%s. Must contain 2 tokens", key.c_str());
return task_process_status::task_invalid_entry;
}
vector<string> port_names = tokenize(tokens[0], list_item_delimiter);
Expand All @@ -383,10 +383,10 @@ task_process_status BufferOrch::processPriorityGroup(Consumer &consumer)
{
if(ref_resolve_status::not_resolved == resolve_result)
{
SWSS_LOG_WARN("Missing or invalid pg profile reference specified\n");
SWSS_LOG_WARN("Missing or invalid pg profile reference specified");
return task_process_status::task_need_retry;
}
SWSS_LOG_ERROR("Resolving pg profile reference failed\n");
SWSS_LOG_ERROR("Resolving pg profile reference failed");
return task_process_status::task_failed;
}
sai_attribute_t attr;
Expand All @@ -398,7 +398,7 @@ task_process_status BufferOrch::processPriorityGroup(Consumer &consumer)
SWSS_LOG_DEBUG("processing port:%s", port_name.c_str());
if (!gPortsOrch->getPort(port_name, port))
{
SWSS_LOG_ERROR("Port with alias:%s not found\n", port_name.c_str());
SWSS_LOG_ERROR("Port with alias:%s not found", port_name.c_str());
return task_process_status::task_invalid_entry;
}
for (size_t ind = range_low; ind <= range_high; ind++)
Expand Down Expand Up @@ -438,7 +438,7 @@ task_process_status BufferOrch::processIngressBufferProfileList(Consumer &consum
SWSS_LOG_DEBUG("processing:%s", key.c_str());
if (consumer.m_consumer->getTableName() != APP_BUFFER_PORT_INGRESS_PROFILE_LIST_NAME)
{
SWSS_LOG_ERROR("Key with invalid table type passed in %s, expected:%s\n", key.c_str(), APP_BUFFER_PORT_INGRESS_PROFILE_LIST_NAME);
SWSS_LOG_ERROR("Key with invalid table type passed in %s, expected:%s", key.c_str(), APP_BUFFER_PORT_INGRESS_PROFILE_LIST_NAME);
return task_process_status::task_invalid_entry;
}
vector<string> port_names = tokenize(key, list_item_delimiter);
Expand All @@ -448,10 +448,10 @@ task_process_status BufferOrch::processIngressBufferProfileList(Consumer &consum
{
if(ref_resolve_status::not_resolved == resolve_status)
{
SWSS_LOG_WARN("Missing or invalid ingress buffer profile reference specified for:%s\n", key.c_str());
SWSS_LOG_WARN("Missing or invalid ingress buffer profile reference specified for:%s", key.c_str());
return task_process_status::task_need_retry;
}
SWSS_LOG_ERROR("Failed resolving ingress buffer profile reference specified for:%s\n", key.c_str());
SWSS_LOG_ERROR("Failed resolving ingress buffer profile reference specified for:%s", key.c_str());
return task_process_status::task_failed;
}
sai_attribute_t attr;
Expand All @@ -462,7 +462,7 @@ task_process_status BufferOrch::processIngressBufferProfileList(Consumer &consum
{
if (!gPortsOrch->getPort(port_name, port))
{
SWSS_LOG_ERROR("Port with alias:%s not found\n", port_name.c_str());
SWSS_LOG_ERROR("Port with alias:%s not found", port_name.c_str());
return task_process_status::task_invalid_entry;
}
sai_status_t sai_status = sai_port_api->set_port_attribute(port.m_port_id, &attr);
Expand Down Expand Up @@ -494,10 +494,10 @@ task_process_status BufferOrch::processEgressBufferProfileList(Consumer &consume
{
if(ref_resolve_status::not_resolved == resolve_status)
{
SWSS_LOG_WARN("Missing or invalid egress buffer profile reference specified for:%s\n", key.c_str());
SWSS_LOG_WARN("Missing or invalid egress buffer profile reference specified for:%s", key.c_str());
return task_process_status::task_need_retry;
}
SWSS_LOG_ERROR("Failed resolving egress buffer profile reference specified for:%s\n", key.c_str());
SWSS_LOG_ERROR("Failed resolving egress buffer profile reference specified for:%s", key.c_str());
return task_process_status::task_failed;
}
sai_attribute_t attr;
Expand All @@ -508,7 +508,7 @@ task_process_status BufferOrch::processEgressBufferProfileList(Consumer &consume
{
if (!gPortsOrch->getPort(port_name, port))
{
SWSS_LOG_ERROR("Port with alias:%s not found\n", port_name.c_str());
SWSS_LOG_ERROR("Port with alias:%s not found", port_name.c_str());
return task_process_status::task_invalid_entry;
}
sai_status_t sai_status = sai_port_api->set_port_attribute(port.m_port_id, &attr);
Expand All @@ -531,13 +531,13 @@ void BufferOrch::doTask(Consumer &consumer)
string map_type_name = consumer.m_consumer->getTableName();
if (m_buffer_type_maps.find(map_type_name) == m_buffer_type_maps.end())
{
SWSS_LOG_ERROR("Unrecognised qos table encountered:%s\n", map_type_name.c_str());
SWSS_LOG_ERROR("Unrecognised qos table encountered:%s", map_type_name.c_str());
it = consumer.m_toSync.erase(it);
continue;
}
if (m_bufferHandlerMap.find(map_type_name) == m_bufferHandlerMap.end())
{
SWSS_LOG_ERROR("No handler for key:%s found.\n", map_type_name.c_str());
SWSS_LOG_ERROR("No handler for key:%s found.", map_type_name.c_str());
it = consumer.m_toSync.erase(it);
continue;
}
Expand All @@ -555,7 +555,7 @@ void BufferOrch::doTask(Consumer &consumer)
SWSS_LOG_ERROR("Processing buffer task item failed, exiting.");
return;
case task_process_status::task_need_retry:
SWSS_LOG_ERROR("Processing buffer task item failed, will retry.");
SWSS_LOG_INFO("Processing buffer task item failed, will retry.");
it++;
break;
default:
Expand Down
46 changes: 23 additions & 23 deletions orchagent/qosorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ task_process_status QosMapHandler::processWorkItem(Consumer& consumer)
{
if (SAI_NULL_OBJECT_ID == sai_object)
{
SWSS_LOG_ERROR("Object with name:%s not found.\n", qos_object_name.c_str());
SWSS_LOG_ERROR("Object with name:%s not found.", qos_object_name.c_str());
return task_process_status::task_invalid_entry;
}
if (!removeQosItem(sai_object))
Expand All @@ -114,7 +114,7 @@ task_process_status QosMapHandler::processWorkItem(Consumer& consumer)
}
else
{
SWSS_LOG_ERROR("Unknown operation type %s\n", op.c_str());
SWSS_LOG_ERROR("Unknown operation type %s", op.c_str());
return task_process_status::task_invalid_entry;
}
return task_process_status::task_success;
Expand Down Expand Up @@ -734,7 +734,7 @@ task_process_status QosOrch::handleSchedulerTable(Consumer& consumer)
sai_object = (*(m_qos_maps[qos_map_type_name]))[qos_object_name];
if (sai_object == SAI_NULL_OBJECT_ID)
{
SWSS_LOG_ERROR("Error sai_object must exist for key %s\n", qos_object_name.c_str());
SWSS_LOG_ERROR("Error sai_object must exist for key %s", qos_object_name.c_str());
return task_process_status::task_invalid_entry;
}
}
Expand Down Expand Up @@ -811,7 +811,7 @@ task_process_status QosOrch::handleSchedulerTable(Consumer& consumer)
{
if (SAI_NULL_OBJECT_ID == sai_object)
{
SWSS_LOG_ERROR("Object with name:%s not found.\n", qos_object_name.c_str());
SWSS_LOG_ERROR("Object with name:%s not found.", qos_object_name.c_str());
return task_process_status::task_invalid_entry;
}
sai_status = sai_scheduler_api->remove_scheduler_profile(sai_object);
Expand All @@ -825,7 +825,7 @@ task_process_status QosOrch::handleSchedulerTable(Consumer& consumer)
}
else
{
SWSS_LOG_ERROR("Unknown operation type %s\n", op.c_str());
SWSS_LOG_ERROR("Unknown operation type %s", op.c_str());
return task_process_status::task_invalid_entry;
}
return task_process_status::task_success;
Expand Down Expand Up @@ -978,7 +978,7 @@ task_process_status QosOrch::handleQueueTable(Consumer& consumer)
tokens = tokenize(key, delimiter);
if (tokens.size() != 2)
{
SWSS_LOG_ERROR("malformed key:%s. Must contain 2 tokens\n", key.c_str());
SWSS_LOG_ERROR("malformed key:%s. Must contain 2 tokens", key.c_str());
return task_process_status::task_invalid_entry;
}
port_names = tokenize(tokens[0], list_item_delimiter);
Expand All @@ -993,7 +993,7 @@ task_process_status QosOrch::handleQueueTable(Consumer& consumer)
SWSS_LOG_DEBUG("processing port:%s", port_name.c_str());
if (!gPortsOrch->getPort(port_name, port))
{
SWSS_LOG_ERROR("Port with alias:%s not found\n", port_name.c_str());
SWSS_LOG_ERROR("Port with alias:%s not found", port_name.c_str());
return task_process_status::task_invalid_entry;
}
SWSS_LOG_DEBUG("processing range:%d-%d", range_low, range_high);
Expand All @@ -1016,12 +1016,12 @@ task_process_status QosOrch::handleQueueTable(Consumer& consumer)
}
else
{
SWSS_LOG_ERROR("Unknown operation type %s\n", op.c_str());
SWSS_LOG_ERROR("Unknown operation type %s", op.c_str());
return task_process_status::task_invalid_entry;
}
if (!result)
{
SWSS_LOG_ERROR("Failed setting field:%s to port:%s, queue:%zd, line:%d\n", scheduler_field_name.c_str(), port.m_alias.c_str(), queue_ind, __LINE__);
SWSS_LOG_ERROR("Failed setting field:%s to port:%s, queue:%zd, line:%d", scheduler_field_name.c_str(), port.m_alias.c_str(), queue_ind, __LINE__);
return task_process_status::task_failed;
}
SWSS_LOG_DEBUG("Applied scheduler to port:%s", port_name.c_str());
Expand All @@ -1030,10 +1030,10 @@ task_process_status QosOrch::handleQueueTable(Consumer& consumer)
{
if(ref_resolve_status::not_resolved == resolve_result)
{
SWSS_LOG_INFO("Missing or invalid scheduler reference\n");
SWSS_LOG_INFO("Missing or invalid scheduler reference");
return task_process_status::task_need_retry;
}
SWSS_LOG_ERROR("Resolving scheduler reference failed\n");
SWSS_LOG_ERROR("Resolving scheduler reference failed");
return task_process_status::task_failed;
}

Expand All @@ -1052,12 +1052,12 @@ task_process_status QosOrch::handleQueueTable(Consumer& consumer)
}
else
{
SWSS_LOG_ERROR("Unknown operation type %s\n", op.c_str());
SWSS_LOG_ERROR("Unknown operation type %s", op.c_str());
return task_process_status::task_invalid_entry;
}
if (!result)
{
SWSS_LOG_ERROR("Failed setting field:%s to port:%s, queue:%zd, line:%d\n", wred_profile_field_name.c_str(), port.m_alias.c_str(), queue_ind, __LINE__);
SWSS_LOG_ERROR("Failed setting field:%s to port:%s, queue:%zd, line:%d", wred_profile_field_name.c_str(), port.m_alias.c_str(), queue_ind, __LINE__);
return task_process_status::task_failed;
}
SWSS_LOG_DEBUG("Applied wred profile to port:%s", port_name.c_str());
Expand All @@ -1066,10 +1066,10 @@ task_process_status QosOrch::handleQueueTable(Consumer& consumer)
{
if(ref_resolve_status::not_resolved == resolve_result)
{
SWSS_LOG_ERROR("Missing or invalid wred reference\n");
SWSS_LOG_INFO("Missing or invalid wred reference");
return task_process_status::task_need_retry;
}
SWSS_LOG_ERROR("Resolving wred reference failed\n");
SWSS_LOG_ERROR("Resolving wred reference failed");
return task_process_status::task_failed;
}
}
Expand All @@ -1089,7 +1089,7 @@ bool QosOrch::applyMapToPort(Port &port, sai_attr_id_t attr_id, sai_object_id_t
sai_status_t status = sai_port_api->set_port_attribute(port.m_port_id, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed setting sai object:%lx for port:%s, status:%d\n", map_id, port.m_alias.c_str(), status);
SWSS_LOG_ERROR("Failed setting sai object:%lx for port:%s, status:%d", map_id, port.m_alias.c_str(), status);
return false;
}
return true;
Expand Down Expand Up @@ -1120,25 +1120,25 @@ task_process_status QosOrch::ResolveMapAndApplyToPort(
}
else
{
SWSS_LOG_ERROR("Unknown operation type %s\n", op.c_str());
SWSS_LOG_ERROR("Unknown operation type %s", op.c_str());
return task_process_status::task_invalid_entry;
}
if (!result)
{
SWSS_LOG_ERROR("Failed setting field:%s to port:%s, line:%d\n", field_name.c_str(), port.m_alias.c_str(), __LINE__);
SWSS_LOG_ERROR("Failed setting field:%s to port:%s, line:%d", field_name.c_str(), port.m_alias.c_str(), __LINE__);
return task_process_status::task_failed;
}
SWSS_LOG_DEBUG("Applied field:%s to port:%s, line:%d\n", field_name.c_str(), port.m_alias.c_str(), __LINE__);
SWSS_LOG_DEBUG("Applied field:%s to port:%s, line:%d", field_name.c_str(), port.m_alias.c_str(), __LINE__);
return task_process_status::task_success;
}
else if (resolve_result != ref_resolve_status::field_not_found)
{
if(ref_resolve_status::not_resolved == resolve_result)
{
SWSS_LOG_ERROR("Missing or invalid %s reference\n", field_name.c_str());
SWSS_LOG_INFO("Missing or invalid %s reference", field_name.c_str());
return task_process_status::task_need_retry;
}
SWSS_LOG_ERROR("Resolving %s reference failed\n", field_name.c_str());
SWSS_LOG_ERROR("Resolving %s reference failed", field_name.c_str());
return task_process_status::task_failed;
}
return task_process_status::task_success;
Expand Down Expand Up @@ -1246,13 +1246,13 @@ void QosOrch::doTask(Consumer &consumer)
string qos_map_type_name = consumer.m_consumer->getTableName();
if (m_qos_maps.find(qos_map_type_name) == m_qos_maps.end())
{
SWSS_LOG_ERROR("Unrecognised qos table encountered:%s\n", qos_map_type_name.c_str());
SWSS_LOG_ERROR("Unrecognised qos table encountered:%s", qos_map_type_name.c_str());
it = consumer.m_toSync.erase(it);
continue;
}
if (m_qos_handler_map.find(qos_map_type_name) == m_qos_handler_map.end())
{
SWSS_LOG_ERROR("No handler for key:%s found.\n", qos_map_type_name.c_str());
SWSS_LOG_ERROR("No handler for key:%s found.", qos_map_type_name.c_str());
it = consumer.m_toSync.erase(it);
continue;
}
Expand Down

0 comments on commit f9d9f18

Please sign in to comment.