summaryrefslogtreecommitdiff
path: root/redfish-core/lib/storage.hpp
AgeCommit message (Collapse)AuthorFilesLines
2021-06-03Remove Redfish Node classJohn Edward Broadbent1-383/+366
Reduces the total number of lines and will allow for easier testing of the redfish responses. A main purpose of the node class was to set app.routeDynamic(). However now app.routeDynamic can handle the complexity that was once in critical to node. The macro app.routeDynamic() provides a shorter cleaner interface to the unerlying app.routeDyanic call. The old pattern set permissions for 6 interfaces (get, head, patch, put, delete_, and post) even if only one interface is created. That pattern creates unneeded code that can be safely removed with no effect. Unit test for the responses would have to mock the node the class in order to fully test responses. see https://github.com/openbmc/bmcweb/issues/181 The following files still need node to be extracted. virtual_media.hpp account_service.hpp redfish_sessions.hpp ethernet.hpp The files above use a pattern that is not trivial to address. Often their responses call an async lambda capturing the inherited class. ie (https://github.com/openbmc/bmcweb/blob/ffed87b5ad1797ca966d030e7f979770 28d258fa/redfish-core/lib/account_service.hpp#L1393) At a later point I plan to remove node from the files above. Tested: I ran the docker unit test with the following command. WORKSPACE=$(pwd) UNIT_TEST_PKG=bmcweb ./openbmc-build-scripts/run-unit-test-docker.sh I ran the validator and this change did not create any issues. python3 RedfishServiceValidator.py -c config.ini Signed-off-by: John Edward Broadbent <jebr@google.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I147a0289c52cb4198345b1ad9bfe6fdddf57f3df
2021-04-21Redfish : Return after InternalError instead of ContinueChicago Duan1-2/+2
"After setting response to internal error you should stop adding more content to response. Try to return instead of continuing a loop" https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/39970/9/redfish-core/lib/pcie_slots.hpp#169 Signed-off-by: Chicago Duan <duanzhijia01@inspur.com> Change-Id: Iadd3062ba7fef31ba61eea1e79eb3a903716b9e9
2021-04-08Using AsyncResp everywherezhanghch051-20/+22
Get the core using AsyncResp everywhere, and not have each individual handler creating its own object.We can call app.handle() without fear of the response getting ended after the first tree is done populating. Don't use res.end() anymore. Tested: 1. Validator passed. Signed-off-by: zhanghaicheng <zhanghch05@inspur.com> Change-Id: I867367ce4a0caf8c4b3f4e07e06c11feed0782e8
2020-10-23Turn on ALL perf checksEd Tanous1-2/+2
1st, alphabetize the tidy-list for good housekeeping. Next, enable all the clang-tidy performance checks, and resolve all the issues. most of the issues boil down to: 1. Using std::move on const variables. This does nothing. 2. Passing big variables (like std::string) by value. 3. Using double quotes on a find call, which constructs an intermediate string, rather than using the character overload. Tested Loaded on system, logged in successfully and pulled down webui-vue. No new errors. Walked the Redfish tree a bit, and observed no new problems. Ran redfish service validator. Got no new failures (although there are a lot of log service deprecation warnings that we should look at). Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I2238958c4b22c1e554e09a0a1787c744bdbca43e
2020-10-15Lots of performance improvementsEd Tanous1-1/+1
(In the voice of the kid from sixth sense) I see string copies... Apparently there are a lot of places we make unnecessary copies. This fixes all of them. Not sure how to split this up into smaller patches, or if it even needs split up. It seems pretty easy to review to me, because basically every diff is identical. Change-Id: I22b4ae4f96f7e4082d2bc701098a04f7bed95369 Signed-off-by: Ed Tanous <ed@tanous.net> Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
2020-08-17Enable unused variable warnings and resolveEd Tanous1-11/+11
This commit enables the "unused variables" warning in clang. Throughout this, it did point out several issues that would've been functional bugs, so I think it was worthwhile. It also cleaned up several unused variable from old constructs that no longer exist. Tested: Built with clang. Code no longer emits warnings. Downloaded bmcweb to system and pulled up the webui, observed webui loads and logs in properly. Change-Id: I51505f4222cc147d6f2b87b14d7e2ac4a74cafa8 Signed-off-by: Ed Tanous <ed@tanous.net>
2020-08-17Enable clang warningsEd Tanous1-8/+8
This commit enables clang warnings, and fixes all warnings that were found. Most of these fall into a couple categories: Variable shadow issues were fixed by renaming variables unused parameter warnings were resolved by either checking error codes that had been ignored, or removing the name of the variable from the scope. Other various warnings were fixed in the best way I was able to come up with. Note, the redfish Node class is especially insidious, as it causes all imlementers to have variables for parameters, regardless of whether or not they are used. Deprecating the Node class is on my list of things to do, as it adds extra overhead, and in general isn't a useful abstraction. For now, I have simply fixed all the handlers. Tested: Added the current meta-clang meta layer into bblayers.conf, and added TOOLCHAIN_pn-bmcweb = "clang" to my local.conf Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: Ia75b94010359170159c703e535d1c1af182fe700
2020-08-17Remove middlewaresEd Tanous1-3/+3
Middlewares, while kinda cool from an academic standpoint, make our build times even worse than they already are. Given that we only really use 1 real middleware today (token auth) and it needs to move into the parser mode anyway (for security limiting buffer sizes), we might as well use this as an opportunity to delete some code. Some other things that happen: 1. Persistent data now moves out of the crow namespace 2. App is no longer a template 3. All request_routes implementations no longer become templates. This should be a decent (unmeasured) win on compile times. This commit was part of a commit previously called "various cleanups". This separates ONLY the middleware deletion part of that. Note, this also deletes about 400 lines of hard to understand code. Change-Id: I4c19e25491a153a2aa2e4ef46fc797bcb5b3581a Signed-off-by: Ed Tanous <ed@tanous.net>
2020-06-11clang-format: update to latest from docs repoGunnar Mills1-46/+46
This is from openbmc/docs/style/cpp/.clang-format Other OpenBMC repos are doing the same. Tested: Built and validator passed. Change-Id: Ief26c755c9ce012823e16a506342b0547a53517a Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-04-16Redfish: Allow slash at the end of ResourceGunnar Mills1-1/+1
This is defined in the Redfish protocol. Easiest way to allow this is to end the Node URL with "/", which most Nodes in bmcweb already had. Before: curl -k https://${bmc}/redfish/v1/TaskService/ Not Found After both /redfish/v1/TaskService/ and /redfish/v1/TaskService return the Task Service. Tested: Validator passed. Change-Id: Ic806dc5c91f631b87642e49b486a6b6da7fdf955 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-02-20Storage: Remove odata.contextGunnar Mills1-8/+0
Redfish made odata.context optional (1.6.0 of DSP0266, Sept 2018). Redfish has removed odata.context from example payloads in the specification (1.7.0 of DSP0266), removed it from the mockups, and Redfish recommended not using. The reason for making optional and removing from mockups/examples, "no one could figure out how to use it and it did not add value". Don't see value in it for our implementation. Change-Id: I16b95a4923f4b764d82cf3bc71b2ca51896822ef Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2019-11-27Remove error for empty subtree responseJames Feist1-1/+1
This interface doesn't have to exist Change-Id: If0ea4e3c201c80c25e825f64ba3601685ef9ed95 Signed-off-by: James Feist <james.feist@linux.intel.com>
2019-11-27Storage: Add Storage ControllerJames Feist1-19/+171
This adds support for Storage Controllers. Tested: Validator passed { "@odata.context": "/redfish/v1/$metadata#Storage.Storage", "@odata.id": "/redfish/v1/Systems/system/Storage/1", "@odata.type": "#Storage.v1_7_1.Storage", "Drives": [ { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drives/Drive_1" }, { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drives/Drive_2" }, { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drives/Drive_3" }, { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drives/Drive_4" }, { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drives/Drive_5" }, { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drives/Drive_6" }, { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drives/Drive_7" }, { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drives/Drive_8" } ], "Drives@odata.count": 8, "Id": "1", "Name": "Storage Controller", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, "StorageControllers": [ { "@odata.context": "/redfish/v1/$metadata#Storage.StorageController", "@odata.id": "/redfish/v1/Systems/system/Storage/1#/StorageControllers/0", "@odata.type": "#Storage.v1_7_0.StorageController", "Manufacturer": "$BOARD_MANUFACTURER", "MemberId": "HSBP_1", "Model": "$BOARD_PRODUCT_NAME", "Name": "HSBP_1", "PartNumber": "$BOARD_PART_NUMBER", "SerialNumber": "$BOARD_SERIAL_NUMBER", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" } } ] } Change-Id: I9d956343daa74ddfa912e3cbe0d38b0e42a4859f Signed-off-by: James Feist <james.feist@linux.intel.com>
2019-11-04Add Storage Health & Update Systems HealthJames Feist1-30/+35
This adds health to storage based on drive inventory and updates systems health to include drives. This also fixes properties that are manditory in drives to make this patch pass the validator. Tested: Validator Passed. Failed a drive and saw: { "@odata.context": "/redfish/v1/$metadata#Storage.Storage", "@odata.id": "/redfish/v1/Systems/system/Storage/1", "@odata.type": "#Storage.v1_7_1.Storage", "Drives": [ { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drive/Drive_1" }, { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drive/Drive_2" }, { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drive/Drive_3" }, { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drive/Drive_4" }, { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drive/Drive_5" }, { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drive/Drive_6" }, { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drive/Drive_7" }, { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drive/Drive_8" } ], "Drives@odata.count": 8, "Id": "1", "Name": "Storage Controller", "Status": { "Health": "Warning", "HealthRollup": "Warning", "State": "Enabled" } } And In systems: "Status": { "Health": "Warning", "HealthRollup": "Warning", "State": "Enabled" }, Change-Id: I7abf042ac51b1fbe9e4ee0b72876e9be96e60b7c Signed-off-by: James Feist <james.feist@linux.intel.com>
2019-11-01storage: s/Drive/DrivesJames Feist1-3/+3
The link was wrong, fix it. Tested: Navigated to a drive using new path, and it worked. Change-Id: Ie008efef23f4a7a17bfc0c3f74a4deac87e0d94c Signed-off-by: James Feist <james.feist@linux.intel.com>
2019-10-24Add Rebuilding to DrivesJames Feist1-0/+29
When the xyz.openbmc_project.Drive.State has rebuilding set true, make the state Updating. Tested: { "@odata.context": "/redfish/v1/$metadata#Drive.Drive", "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drive/Drive_1", "@odata.type": "#Drive.v1_2_0.Drive", "Id": "Drive_1", "Manufacturer": "INTEL", "Model": "P4800X", "Name": "Drive_1", "PartNumber": "INTEL SSDPE21K375GA", "SerialNumber": "PHKE722600NL375AGN", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Updating" } } Change-Id: I401e5a8c416d969831cebde8b5b0723f41c3e1c7 Signed-off-by: James Feist <james.feist@linux.intel.com>
2019-10-24Add Storage SchemaNikhil Potade1-0/+286
This takes the original commit below and updates it so that it passes the validatior, and provides the Status attribute in redfish when appropriate. Tested: Passed the validator { "@odata.context": "/redfish/v1/$metadata#Drive.Drive", "@odata.id": "/redfish/v1/Systems/system/Storage/1/Drive/Drive_2", "@odata.type": "#Drive.v1_2_0.Drive", "Id": "Drive_2", "Manufacturer": "INTEL", "Model": "P4800X", "Name": "Drive_2", "PartNumber": "INTEL SSDPE21K375GA", "SerialNumber": "PHKE722600NL375AGN", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" } } Original Commit Message: ------------------------------------------------------------------- Add Storage Schema for NVMe on Redfish This provides an implementation for the Get methods for the Storage schemas using following classes : - StorageCollection - Storage Tested: - Ran Redfish Service Validator to verify no issues are reported. - Tested that the NVMe drives in the system show up and proper fields are populated with appropriate data. - Tested with no drives present. Made sure the Storage interface shows no drives and Drive interface returns error message. Change-Id: Id0306ea413ac16a993110bb1a36cd95d939cff71 Signed-off-by: Nikhil Potade <nikhil.potade@linux.intel.com> Signed-off-by: James Feist <james.feist@linux.intel.com>
2019-10-03Revert "Add Storage Schema for NVMe on Redfish"Ed Tanous1-250/+0
This reverts commit e56c7b7092298c609831a65bcc8c21e62d422ba7. Reason for revert: /redfish/v1/Systems/1 returns no result. This should've been flagged in service validator, but the commit mentions that test was run, so it's not clear how this was missed. Reverting for a moment until we can determine what happened. Change-Id: I276d4cd239adb87b77264bc65ab4856705274ff0
2019-10-01Add Storage Schema for NVMe on RedfishNikhil Potade1-0/+250
This provides an implementation for the Get methods for the Storage schemas using following classes : - StorageCollection - Storage Tested: - Ran Redfish Service Validator to verify no issues are reported. - Tested that the NVMe drives in the system show up and proper fields are populated with appropriate data. - Tested with no drives present. Made sure the Storage interface shows no drives and Drive interface returns error message. Signed-off-by: Nikhil Potade <nikhil.potade@linux.intel.com> Change-Id: I9fa9f4cd69fe07cde15604c5405a6987774065fd