Skip to content

Commit 0909192

Browse files
kcudnikShuotian Cheng
authored and
Shuotian Cheng
committed
[orchagent]: Set log recording directory before enable recording (#300)
1 parent 2e4e27c commit 0909192

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

orchagent/saihelper.cpp

+15-10
Original file line numberDiff line numberDiff line change
@@ -172,18 +172,10 @@ void initSaiRedis(const string &record_location)
172172
* to be performed, and they should be executed before creating switch.
173173
*/
174174

175-
/* Disable/enable SAI Redis recording */
176175
sai_attribute_t attr;
177-
attr.id = SAI_REDIS_SWITCH_ATTR_RECORD;
178-
attr.value.booldata = gSairedisRecord;
176+
sai_status_t status;
179177

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

188180
if (gSairedisRecord)
189181
{
@@ -200,6 +192,19 @@ void initSaiRedis(const string &record_location)
200192
}
201193
}
202194

195+
/* Disable/enable SAI Redis recording */
196+
197+
attr.id = SAI_REDIS_SWITCH_ATTR_RECORD;
198+
attr.value.booldata = gSairedisRecord;
199+
200+
status = sai_switch_api->set_switch_attribute(gSwitchId, &attr);
201+
if (status != SAI_STATUS_SUCCESS)
202+
{
203+
SWSS_LOG_ERROR("Failed to %s SAI Redis recording, rv:%d",
204+
gSairedisRecord ? "enable" : "disable", status);
205+
exit(EXIT_FAILURE);
206+
}
207+
203208
attr.id = SAI_REDIS_SWITCH_ATTR_USE_PIPELINE;
204209
attr.value.booldata = true;
205210

0 commit comments

Comments
 (0)