From 0909192b39ed7269d72df3fccc229d5d80e104db Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Mon, 28 Aug 2017 11:22:58 -0700 Subject: [PATCH] [orchagent]: Set log recording directory before enable recording (#300) --- orchagent/saihelper.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/orchagent/saihelper.cpp b/orchagent/saihelper.cpp index cafe7c70c314..15cb600a6f25 100644 --- a/orchagent/saihelper.cpp +++ b/orchagent/saihelper.cpp @@ -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) { @@ -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;