-
Notifications
You must be signed in to change notification settings - Fork 148
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
PSUD-Delete or update CHASSIS_INFO table PSU/Modules data if added or… #351
PSUD-Delete or update CHASSIS_INFO table PSU/Modules data if added or… #351
Conversation
… removed. Signed-off-by: prem-nokia <premnath.saravanan@nokia.com>
8e7c1f7
to
d60990f
Compare
@prgeor @abdosi @kenneth-arista @rlhui @arlakshm Hi, Friendly reminder. Please help to review this PR. Thanks. |
The changes look reasonable to me. Do you have test cases to simulate removal of PSUs, fans and/or linecards? |
No, but the new test implementation will always be executed during the build test, irrespective of additional or removal of PSUs, fans and/or linecards. |
sonic-psud/scripts/psud
Outdated
name = try_get(psu.get_name, 'PSU {}'.format(index + 1)) | ||
chassis_tbl.hdel(CHASSIS_INFO_POWER_KEY_TEMPLATE.format(1), CHASSIS_INFO_POWER_SUPPLIER_FIELD.format(name)) | ||
continue | ||
|
||
power_good = try_get(psu.get_powergood_status) | ||
if not power_good: | ||
name = try_get(psu.get_name, 'PSU {}'.format(index + 1)) |
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.
can we retrieve the name
outside instead of repeating in the same block?
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.
@prgeor, Hi Prince, This comment has been addressed. Please review it. Thanks
sonic-psud/scripts/psud
Outdated
name = try_get(power_consumer.get_name, 'FAN-DRAWER {}'.format(index)) | ||
chassis_tbl.hdel(CHASSIS_INFO_POWER_KEY_TEMPLATE.format(1), CHASSIS_INFO_POWER_CONSUMER_FIELD.format(name)) | ||
continue | ||
|
||
name = try_get(power_consumer.get_name, 'FAN-DRAWER {}'.format(index)) |
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.
can we retrieve the name
outside the block so that it can be reused ?
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.
Yes we could do that, it makes the script more understandable, but "name" is not reused in the for loop and either way it will be retrieved only once (either it is retrieved inside the if statements or outside).
@prem-nokia please check comments |
Maybe I am misunderstanding the code changes to (a) when the PSU is missing |
Signed-off-by: premsara <premnath.saravanan@nokia.com>
@prgeor This change is also required for branch 202205 |
@prgeor would you please create an msft ado for this for cherry pick? thanks. |
@yxieca please help cherry-pick |
@gechiang can you please help create Microsoft ADO for this so that we can pick into 202205. |
@gechiang it is there in 202205 ? |
@yxieca MSFT ADO: 24297786 |
#351) * PSUD-Delete or update CHASSIS_INFO table PSU/Modules data if added or removed. Signed-off-by: prem-nokia <premnath.saravanan@nokia.com> * fix swsscommon.py hdel function. * implemented code optimization. Signed-off-by: premsara <premnath.saravanan@nokia.com> --------- Signed-off-by: prem-nokia <premnath.saravanan@nokia.com> Signed-off-by: premsara <premnath.saravanan@nokia.com>
@prem-nokia , can you clarify if this change was tested with an image that is 202205 based? How was it tested? Did you physically removed the LC/FAN and see your change takes place without seeing the change causing other issues? |
#351) * PSUD-Delete or update CHASSIS_INFO table PSU/Modules data if added or removed. Signed-off-by: prem-nokia <premnath.saravanan@nokia.com> * fix swsscommon.py hdel function. * implemented code optimization. Signed-off-by: premsara <premnath.saravanan@nokia.com> --------- Signed-off-by: prem-nokia <premnath.saravanan@nokia.com> Signed-off-by: premsara <premnath.saravanan@nokia.com>
This change has been tested on both 202205 and master with physically removing Linecard, Fan and Psu. Related issue was found on 202205 originally. Thanks for the following up. |
MSFT ADO: 24297786
Description
Code changes are implemented to update or delete entry in CHASSIS_INFO table if the PSU/Fan/Modules are added or removed.
Motivation and Context
Dynamically deletes or updates the tables and gives the updated data in real time values.
How Has This Been Tested?
Run the below commands
1.Initial state.
2.After PSU, Fan and line card removed.
Additional Information (Optional)