-
Notifications
You must be signed in to change notification settings - Fork 20
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
Execute Post Fail Action if VPD parsing fails #425
base: P11_Dev
Are you sure you want to change the base?
Execute Post Fail Action if VPD parsing fails #425
Conversation
This commit adds changes to execute Post Fail Action for a FRU if Pre Action for the FRU has passed and VPD parsing has failed. Test: 1. Create a malformed VPD file by modifying copy of 7-0051/eeprom, name the copy as 7-0051_eeprom_noVTOC.dat 2. Create a copy of 50001001.json, name the copy as 50001001_custom.json. Replace "/sys/bus/i2c/drivers/at24/7-0051/eeprom" string in the custom JSON with "7-0051_eeprom_noVTOC.dat". 3. Run ./vpd-parser -f /tmp/7-0051_eeprom_noVTOC.dat -c ./50001001_custom.json. 4. Observe the logs to see "preAction" is successful, VPD parsing fails and "postFailAction" is executed as specified in the custom JSON. 5. Now run /vpd-parser -f /sys/bus/i2c/drivers/at24/7-0051/eeprom -c ./50001001.json. 6. Observe the logs to see "preAction" is successful, VPD parsing is successful and "postFailAction" is not executed. Signed-off-by: Souvik Roy <[email protected]>
1c1f475
to
b723db3
Compare
This commit adds changes to execute Post Fail Action for a FRU if Pre Action for the FRU has passed and VPD parsing has failed. Test: 1. Create a malformed VPD file by modifying copy of 7-0051/eeprom, name the copy as 7-0051_eeprom_noVTOC.dat 2. Create a copy of 50001001.json, name the copy as 50001001_custom.json. Replace "/sys/bus/i2c/drivers/at24/7-0051/eeprom" string in the custom JSON with "7-0051_eeprom_noVTOC.dat". 3. Run ./vpd-parser -f /tmp/7-0051_eeprom_noVTOC.dat -c ./50001001_custom.json. 4. Observe the logs to see "preAction" is successful, VPD parsing fails and "postFailAction" is executed as specified in the custom JSON. 5. Now run /vpd-parser -f /sys/bus/i2c/drivers/at24/7-0051/eeprom -c ./50001001.json. 6. Observe the logs to see "preAction" is successful, VPD parsing is successful and "postFailAction" is not executed. Signed-off-by: Souvik Roy <[email protected]>
b723db3
to
eabd0a2
Compare
This commit adds changes to execute Post Fail Action for a FRU if Pre Action for the FRU has passed and VPD parsing has failed. Test: 1. Create a malformed VPD file by modifying copy of 7-0051/eeprom, name the copy as 7-0051_eeprom_noVTOC.dat 2. Create a copy of 50001001.json, name the copy as 50001001_custom.json. Replace "/sys/bus/i2c/drivers/at24/7-0051/eeprom" string in the custom JSON with "7-0051_eeprom_noVTOC.dat". 3. Run ./vpd-parser -f /tmp/7-0051_eeprom_noVTOC.dat -c ./50001001_custom.json. 4. Observe the logs to see "preAction" is successful, VPD parsing fails and "postFailAction" is executed as specified in the custom JSON. 5. Now run /vpd-parser -f /sys/bus/i2c/drivers/at24/7-0051/eeprom -c ./50001001.json. 6. Observe the logs to see "preAction" is successful, VPD parsing is successful and "postFailAction" is not executed. Signed-off-by: Souvik Roy <[email protected]>
eabd0a2
to
63f03b4
Compare
This commit adds changes to execute Post Fail Action for a FRU if Pre Action for the FRU has passed and VPD parsing has failed. Test: 1. Create a malformed VPD file by modifying copy of 7-0051/eeprom, name the copy as 7-0051_eeprom_noVTOC.dat 2. Create a copy of 50001001.json, name the copy as 50001001_custom.json. Replace "/sys/bus/i2c/drivers/at24/7-0051/eeprom" string in the custom JSON with "7-0051_eeprom_noVTOC.dat". 3. Run ./vpd-parser -f /tmp/7-0051_eeprom_noVTOC.dat -c ./50001001_custom.json. 4. Observe the logs to see "preAction" is successful, VPD parsing fails and "postFailAction" is executed as specified in the custom JSON. 5. Now run /vpd-parser -f /sys/bus/i2c/drivers/at24/7-0051/eeprom -c ./50001001.json. 6. Observe the logs to see "preAction" is successful, VPD parsing is successful and "postFailAction" is not executed. 7. Create a copy of 50001001_custom.json 50001001_custom_noPostFail.json with "PostFailAction" tag deleted. 8. Run ./vpd-parser -f /tmp/7-0051_eeprom_noVTOC.dat -c 50001001_custom_noPostFail.json 9. Observe the logs to see "preAction" is successful, VPD parsing fails and "postFailAction" also fails. Signed-off-by: Souvik Roy <[email protected]>
63f03b4
to
a249b16
Compare
// after collection for FRU is successfully done. | ||
if (jsonUtility::isActionRequired(m_parsedJson, i_vpdFilePath, "postAction", | ||
"collection")) | ||
try |
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.
Should we extend try block for Parser object creation as well ? so we can run "executePostFailAction" .
As we are introducing throwing an exception in Parser constructor.
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.
Parser
constructor does not throw any exception right now. Are we planning to add any throw
in the Parser
constructor later?
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.
#380
raising exception in case of error paths.
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.
@branupama That can be extended once we introduce that change in parser class.
{ | ||
throw std::runtime_error( | ||
"Required post action failed for path " + i_vpdFilePath + | ||
" Aborting collection for this FRU"); |
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.
Why we are aborting the collection if "postAction" fails ?
why we are not populating the collected VPD ?
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.
I didn't change this logic. I just moved it under try
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.
@branupama Why do you think that a FRU should be populated if there is a processing failure at any stage?
src/worker.cpp
Outdated
} | ||
catch (std::exception& ex) |
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.
l_exception ?
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.
We are not using l_
for the exception object reference throughout worker.cpp
, so to maintain consistency, I followed the same convention.
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.
@souvik1914581 The code of worker was written before we brought it the guidelines. Hennce, with new addition we are following that.
Please modify with l_ex.
src/worker.cpp
Outdated
{ | ||
throw std::runtime_error("Post fail action failed for path " + | ||
i_vpdFilePath + | ||
" Aborting collection for this FRU"); |
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.
as we are not aborting anything, is the message should be ?
"VPD collection failed for the FRU " + i_vpdFilePath
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.
We end up in this catch
block if
vpdParser->parse()
throws when parsing fails.processPostAction()
throws ifparsedVpd
has no value.
Do you mean we should check for the type of exception caught and log accordingly here?
On a side note: I just noticed processPostAction()
throws but it's doxygen doesn't mention @throws
.
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.
ok, this is fine.
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.
@souvik1914581 In the case that you have added, in case "executePostFailAction" also fails then we loose the exception that was thrown by the parser path.
Could you please add that log as well to the log that you have added so that we don't miss the reason, why collection failed.
// after collection for FRU is successfully done. | ||
if (jsonUtility::isActionRequired(m_parsedJson, i_vpdFilePath, "postAction", | ||
"collection")) | ||
try |
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.
#380
raising exception in case of error paths.
src/worker.cpp
Outdated
{ | ||
throw std::runtime_error("Post fail action failed for path " + | ||
i_vpdFilePath + | ||
" Aborting collection for this FRU"); |
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.
ok, this is fine.
// after collection for FRU is successfully done. | ||
if (jsonUtility::isActionRequired(m_parsedJson, i_vpdFilePath, "postAction", | ||
"collection")) | ||
try |
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.
@branupama That can be extended once we introduce that change in parser class.
{ | ||
throw std::runtime_error( | ||
"Required post action failed for path " + i_vpdFilePath + | ||
" Aborting collection for this FRU"); |
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.
@branupama Why do you think that a FRU should be populated if there is a processing failure at any stage?
src/worker.cpp
Outdated
} | ||
catch (std::exception& ex) |
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.
@souvik1914581 The code of worker was written before we brought it the guidelines. Hennce, with new addition we are following that.
Please modify with l_ex.
src/worker.cpp
Outdated
{ | ||
throw std::runtime_error("Post fail action failed for path " + | ||
i_vpdFilePath + | ||
" Aborting collection for this FRU"); |
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.
@souvik1914581 In the case that you have added, in case "executePostFailAction" also fails then we loose the exception that was thrown by the parser path.
Could you please add that log as well to the log that you have added so that we don't miss the reason, why collection failed.
This commit adds changes to execute Post Fail Action for a FRU if Pre Action for the FRU has passed and VPD parsing has failed. Test: 1. Create a malformed VPD file by modifying copy of 7-0051/eeprom, name the copy as 7-0051_eeprom_noVTOC.dat 2. Create a copy of 50001001.json, name the copy as 50001001_custom.json. Replace "/sys/bus/i2c/drivers/at24/7-0051/eeprom" string in the custom JSON with "7-0051_eeprom_noVTOC.dat". 3. Run ./vpd-parser -f /tmp/7-0051_eeprom_noVTOC.dat -c ./50001001_custom.json. 4. Observe the logs to see "preAction" is successful, VPD parsing fails and "postFailAction" is executed as specified in the custom JSON. 5. Now run /vpd-parser -f /sys/bus/i2c/drivers/at24/7-0051/eeprom -c ./50001001.json. 6. Observe the logs to see "preAction" is successful, VPD parsing is successful and "postFailAction" is not executed. 7. Create a copy of 50001001_custom.json 50001001_custom_noPostFail.json with "PostFailAction" tag deleted. 8. Run ./vpd-parser -f /tmp/7-0051_eeprom_noVTOC.dat -c 50001001_custom_noPostFail.json 9. Observe the logs to see "preAction" is successful, VPD parsing fails and "postFailAction" also fails. Signed-off-by: Souvik Roy <[email protected]>
a249b16
to
c007e63
Compare
This commit adds changes to execute Post Fail Action for a FRU if Pre Action for the FRU has passed and VPD parsing has failed.
Test: