Skip to content
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

[syseeprom] Add a new daemon to populate syseeprom info to state DB #25

Merged
merged 16 commits into from
Jun 17, 2019
Merged

[syseeprom] Add a new daemon to populate syseeprom info to state DB #25

merged 16 commits into from
Jun 17, 2019

Conversation

keboliu
Copy link
Collaborator

@keboliu keboliu commented Mar 15, 2019

syseeprom: Add a new daemon to populate the syseeprom info to state DB

  • This daemon intends to collect the syseeprom information and write it to state DB, so CLI can get this info from DB instead of access HW. This daemon will keep monitoring the DB table, if table was deleted, it will write the info to DB again.

There will be a followed PR to add make files and modify start.sh after this one merged.

Signed-off-by: Kebo Liu kebol@mellanox.com

sonic-post-syseeprom/scripts/post-syseeprom Outdated Show resolved Hide resolved
sonic-post-syseeprom/scripts/post-syseeprom Outdated Show resolved Hide resolved
sonic-post-syseeprom/scripts/post-syseeprom Outdated Show resolved Hide resolved
sonic-post-syseeprom/setup.py Outdated Show resolved Hide resolved
@lguohan
Copy link
Contributor

lguohan commented Mar 25, 2019

is this eeprom information in state db? the state db is clearly after sonic config load or swss restart. we need to deal with such situation.

Copy link
Contributor

@lguohan lguohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to deal with state clear due to config reload or swss restart.

@keboliu
Copy link
Collaborator Author

keboliu commented Mar 27, 2019

@lguohan added '-w' and '-c' options to the scripts to handle write DB and clear DB functions respectively.

@liat-grozovik
Copy link
Collaborator

@jleveque @lguohan can you please review? this PR is the last piece of the pmon refactoring to be part of 201904

@lguohan
Copy link
Contributor

lguohan commented May 2, 2019

it does not address my comments : "need to deal with state clear due to config reload or swss restart."

@nazariig
Copy link
Collaborator

nazariig commented May 2, 2019

it does not address my comments : "need to deal with state clear due to config reload or swss restart."

@lguohan can we consider having an EEPROM daemon?

@henry-ma
Copy link

henry-ma commented May 5, 2019

@lguohan could you please approve this or raise your comments? We should get it merged as part of Pmon enhancement work.

@keboliu
Copy link
Collaborator Author

keboliu commented May 5, 2019

it does not address my comments : "need to deal with state clear due to config reload or swss restart."

@lguohan, as I mentioned in the description there will be a followd PR against sonic-buildimage which will include the code to call this utility to post info to DB during pmon start and clear DB when pmon stopped. I was planning to create it after this one merged.
Now in order to give you a whole picture of this solution, I just submitted that one: sonic-net/sonic-buildimage#2866 you can find the code where to clear DB when pmon stop, please also review.

@keboliu
Copy link
Collaborator Author

keboliu commented May 5, 2019

it does not address my comments : "need to deal with state clear due to config reload or swss restart."

@lguohan can we consider having an EEPROM daemon?

@nazariig I think it kind of overkill to have a daemon here since eeprom info never changed.

Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As comments

@keboliu
Copy link
Collaborator Author

keboliu commented May 23, 2019

@lguohan I have addressed new comments with Qi and Joe, would you please approve if it's OK to you?

Copy link
Contributor

@jleveque jleveque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keboliu: The event listener does not take care of the situation Guohan was concerned about. I think you misunderstood his comment. We are not concerned with clearing the syseeprom data from the DB when PMON exits; syseeprom data is static and should not change. However, the concern Guohan raised was that the STATE_DB could get cleared by other services (config reload, swss restart, etc.). We need a way to recognize the STATE_DB was cleared and repopulate the syseeprom info into the DB.

The SwSS restart scenario shouldn't be a problem because we have configured the PMon service as a dependent of SwSS via systemd. Thus, if SwSS gets restarted, so too should PMon get restarted. However, we still need a way to get notified that the STATE_DB was cleared so we can repopulate the info.

@keboliu keboliu changed the title [syseeprom] Add a new script to populate syseeprom info to state DB [syseeprom] Add a new daemon to populate syseeprom info to state DB Jun 5, 2019
Copy link
Contributor

@jleveque jleveque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As comments.

sonic-syseepromd/scripts/syseepromd Outdated Show resolved Hide resolved
Copy link
Contributor

@jleveque jleveque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple more small requests.

sonic-syseepromd/scripts/syseepromd Outdated Show resolved Hide resolved
sonic-syseepromd/scripts/syseepromd Outdated Show resolved Hide resolved
@jleveque
Copy link
Contributor

@lguohan: Please review the latest changes.

@jleveque
Copy link
Contributor

@keboliu: A couple comments:

  1. When you add this daemon to the supervisor config file, make sure you set it to restart always to ensure it's always running.
  2. This storage of syseeprom info to STATE_DB should be viewed as a cache to improve performance for non-critical applications (SNMP, streaming telemetry, etc.). However, there are critical applications which rely on obtaining the MAC address. These applications should never fail. Thus, they should rely on calling decode-syseeprom. Therefore, we should not remove the ability for decode-syseeprom to access the hardware directly. At the most, we could modify decode-syseeprom to use the STATE_DB as a cache, and return the data if found, otherwise, it should poll the hardware directly as it currently does.

@keboliu
Copy link
Collaborator Author

keboliu commented Jun 15, 2019

@keboliu: A couple comments:

  1. When you add this daemon to the supervisor config file, make sure you set it to restart always to ensure it's always running.

updated in another PR.

  1. This storage of syseeprom info to STATE_DB should be viewed as a cache to improve performance for non-critical applications (SNMP, streaming telemetry, etc.). However, there are critical applications which rely on obtaining the MAC address. These applications should never fail. Thus, they should rely on calling decode-syseeprom. Therefore, we should not remove the ability for decode-syseeprom to access the hardware directly. At the most, we could modify decode-syseeprom to use the STATE_DB as a cache, and return the data if found, otherwise, it should poll the hardware directly as it currently does.

the current decode-syseeprom logic is implemented as you mentioned, when it failed to get data from DB, it will fall back on access the hardware. So we are ok here.

@jleveque jleveque merged commit 84bca64 into sonic-net:master Jun 17, 2019
vdahiya12 pushed a commit to vdahiya12/sonic-platform-daemons that referenced this pull request Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants