-
Notifications
You must be signed in to change notification settings - Fork 694
Suppress Cable length errors in case pg profile lookup file is not provided #509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,8 @@ void BufferMgr::readPgProfileLookupFile(string file) | |
| ifstream infile(file); | ||
| if (!infile.is_open()) | ||
| { | ||
| m_pgfile_readable = false; | ||
| SWSS_LOG_WARN("PG profile lookup file: %s is not readable", file.c_str()); | ||
| return; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we log an error here?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not necessarily an error if we don't need this feature. I can put an NOTICE or WARNING log message here. #Closed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you are sure the feature is optional, then a WARNING should be ok. In reply to: 189676820 [](ancestors = 189676820)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. assign m_pgfile_exist true here, and you could remove class member initialization in header file.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Either way should do the work, any reason you prefer to put here rather than in the header file?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For better readability.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see any confusion with the initialization in header file. it is easily readable so I kept the code here. |
||
|
|
||
|
|
@@ -211,7 +213,7 @@ void BufferMgr::doTask(Consumer &consumer) | |
| task_status = doCableTask(fvField(i), fvValue(i)); | ||
| } | ||
| // In case of PORT table update, Buffer Manager is interested in speed update only | ||
| if (table_name == CFG_PORT_TABLE_NAME && fvField(i) == "speed") | ||
| if (m_pgfile_readable && table_name == CFG_PORT_TABLE_NAME && fvField(i) == "speed") | ||
| { | ||
| // create/update profile for port | ||
| task_status = doSpeedUpdateTask(port, fvValue(i)); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think m_pgfile_processed a more suitable name for this variable? I would think setting it to false by default, and flip it to true once the file processing is done will serve your purpose better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose was to check whether the "pg-lookup-file" was there or not, if not, we don't do the buffer settings. It renamed to cover the case where the file somehow not readable.
By looking at the code, there wasn't any exist after this "is_open" check and before the entire function. This means if we had m_pgfile_processed defined, we would have always set it to true after this check. I,E, there was no difference between the current approach and if we had a new naming.
Anyway, I changed it so everybody is happy.