Skip to content

Commit

Permalink
[orchagent]: Set log recording directory before enable recording (son…
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik authored and Shuotian Cheng committed Aug 28, 2017
1 parent 2e4e27c commit 0909192
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions orchagent/saihelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,10 @@ void initSaiRedis(const string &record_location)
* to be performed, and they should be executed before creating switch.
*/

/* Disable/enable SAI Redis recording */
sai_attribute_t attr;
attr.id = SAI_REDIS_SWITCH_ATTR_RECORD;
attr.value.booldata = gSairedisRecord;
sai_status_t status;

sai_status_t status = sai_switch_api->set_switch_attribute(gSwitchId, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to %s SAI Redis recording, rv:%d",
gSairedisRecord ? "enable" : "disable", status);
exit(EXIT_FAILURE);
}
/* set recording dir before enable recording */

if (gSairedisRecord)
{
Expand All @@ -200,6 +192,19 @@ void initSaiRedis(const string &record_location)
}
}

/* Disable/enable SAI Redis recording */

attr.id = SAI_REDIS_SWITCH_ATTR_RECORD;
attr.value.booldata = gSairedisRecord;

status = sai_switch_api->set_switch_attribute(gSwitchId, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to %s SAI Redis recording, rv:%d",
gSairedisRecord ? "enable" : "disable", status);
exit(EXIT_FAILURE);
}

attr.id = SAI_REDIS_SWITCH_ATTR_USE_PIPELINE;
attr.value.booldata = true;

Expand Down

0 comments on commit 0909192

Please sign in to comment.