From c4541ee2d7dc0b670dbc2ab4fb3339b7eddae05c Mon Sep 17 00:00:00 2001 From: Hari Date: Wed, 24 Feb 2016 15:22:19 +0530 Subject: [PATCH] Remove unwanted logs. When TCP flows are evicted in vrouter, any further operation from agent on it results in an error to agent. These expected logs are not required and can be removed. Also, added a trace buffer for ksync errors. Change-Id: I7c6a2f38478039e511b3775f27708d9d38111c73 closes-bug: 1542648 --- src/ksync/ksync.sandesh | 9 +++++++++ src/ksync/ksync_entry.h | 8 ++++++++ src/ksync/ksync_object.cc | 14 ++++++++++---- src/vnsw/agent/kstate/kstate.cc | 3 ++- src/vnsw/agent/vrouter/ksync/sandesh_ksync.cc | 6 ------ .../stats_collector/agent_stats_sandesh_context.cc | 3 ++- 6 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/ksync/ksync.sandesh b/src/ksync/ksync.sandesh index 87f64d7cdf3..1f0425d9a8d 100644 --- a/src/ksync/ksync.sandesh +++ b/src/ksync/ksync.sandesh @@ -20,3 +20,12 @@ systemlog sandesh VRouterError { 9: string str5; 10: u64 msg_no; } + +/** + * @description: Trace message for KSync Error + * @type: Trace + * @severity: DEBUG + */ +trace sandesh KSyncErrorTrace { + 1: string message; +} diff --git a/src/ksync/ksync_entry.h b/src/ksync/ksync_entry.h index ab910df5e57..27bc3782398 100644 --- a/src/ksync/ksync_entry.h +++ b/src/ksync/ksync_entry.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #define KSYNC_ERROR(obj, ...)\ @@ -19,6 +20,13 @@ do {\ SandeshLevel::SYS_DEBUG, __FILE__, __LINE__, ##__VA_ARGS__);\ } while (false);\ +extern SandeshTraceBufferPtr KSyncErrorTraceBuf; +#define KSYNC_ERROR_TRACE(obj, ...) \ +do { \ + KSyncError##obj::TraceMsg(KSyncErrorTraceBuf, \ + __FILE__, __LINE__, __VA_ARGS__); \ +} while (false); + class KSyncObject; class KSyncDBObject; diff --git a/src/ksync/ksync_object.cc b/src/ksync/ksync_object.cc index 2e818bd4b4e..04a42f725c8 100644 --- a/src/ksync/ksync_object.cc +++ b/src/ksync/ksync_object.cc @@ -28,6 +28,9 @@ #include "ksync_object.h" #include "ksync_types.h" +SandeshTraceBufferPtr KSyncErrorTraceBuf( + SandeshTraceBufferCreate("KSync Error", 5000)); + KSyncObject::FwdRefTree KSyncObject::fwd_ref_tree_; KSyncObject::BackRefTree KSyncObject::back_ref_tree_; KSyncObjectManager *KSyncObjectManager::singleton_ = NULL; @@ -498,10 +501,13 @@ void KSyncEntry::ErrorHandler(int err, uint32_t seq_no) const { ":", error_msg, ">. Object <", ToString(), ">. Operation <", OperationString(), ">. Message number :", seq_no); - LOG(ERROR, "VRouter operation failed. Error <" << err << ":" << - error_msg << ">. Object <" << ToString() << - ">. Operation <" << OperationString() << ">. Message number :" - << seq_no); + + std::stringstream sstr; + sstr << "VRouter operation failed. Error <" << err << ":" << error_msg << + ">. Object <" << ToString() << ">. Operation <" << + OperationString() << ">. Message number :" << seq_no; + KSYNC_ERROR_TRACE(Trace, sstr.str().c_str()); + LOG(ERROR, sstr.str().c_str()); KSYNC_ASSERT(err == 0); } diff --git a/src/vnsw/agent/kstate/kstate.cc b/src/vnsw/agent/kstate/kstate.cc index b287b76a578..6b70e2dec92 100644 --- a/src/vnsw/agent/kstate/kstate.cc +++ b/src/vnsw/agent/kstate/kstate.cc @@ -47,7 +47,8 @@ int KState::VrResponseMsgHandler(vr_response *r) { resp->Response(); st->Release(); - LOG(ERROR, "Error: " << strerror(-code) << " :code: " << -code); + LOG(ERROR, "Error reading kstate: " << strerror(-code) << + " :code: " << -code); return -code; } diff --git a/src/vnsw/agent/vrouter/ksync/sandesh_ksync.cc b/src/vnsw/agent/vrouter/ksync/sandesh_ksync.cc index 60e4d97b4be..d4f27c34c48 100644 --- a/src/vnsw/agent/vrouter/ksync/sandesh_ksync.cc +++ b/src/vnsw/agent/vrouter/ksync/sandesh_ksync.cc @@ -42,13 +42,7 @@ void vr_mem_stats_req::Process(SandeshContext *context) { int KSyncSandeshContext::VrResponseMsgHandler(vr_response *r) { response_code_ = r->get_resp_code(); - if (-response_code_ == EEXIST) { - return -response_code_; - } - if (response_code_ < 0) { - LOG(ERROR, "VrResponseMsg Error: " << - KSyncEntry::VrouterErrorToString(-response_code_)); return -response_code_; } diff --git a/src/vnsw/agent/vrouter/stats_collector/agent_stats_sandesh_context.cc b/src/vnsw/agent/vrouter/stats_collector/agent_stats_sandesh_context.cc index 8df28e7de82..271ed668ec3 100644 --- a/src/vnsw/agent/vrouter/stats_collector/agent_stats_sandesh_context.cc +++ b/src/vnsw/agent/vrouter/stats_collector/agent_stats_sandesh_context.cc @@ -37,7 +37,8 @@ int AgentStatsSandeshContext::VrResponseMsgHandler(vr_response *r) { } if (code < 0) { - LOG(ERROR, "Error: " << KSyncEntry::VrouterErrorToString(-code)); + LOG(ERROR, "Error in reading Statistics from vrouter: " << + KSyncEntry::VrouterErrorToString(-code)); return -code; }