John Edward Broadbent | e6ffe70 | 2021-10-14 14:03:11 -0700 | [diff] [blame] | 1 | #include "verifyDriveGeometry.hpp" |
| 2 | |
| 3 | #include "estoraged_conf.hpp" |
| 4 | |
| 5 | #include <phosphor-logging/lg2.hpp> |
John Wedig | 972c3fa | 2021-12-29 17:30:41 -0800 | [diff] [blame^] | 6 | #include <xyz/openbmc_project/Common/error.hpp> |
John Edward Broadbent | e6ffe70 | 2021-10-14 14:03:11 -0700 | [diff] [blame] | 7 | |
| 8 | #include <string> |
| 9 | |
John Wedig | 972c3fa | 2021-12-29 17:30:41 -0800 | [diff] [blame^] | 10 | using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; |
John Edward Broadbent | e6ffe70 | 2021-10-14 14:03:11 -0700 | [diff] [blame] | 11 | |
| 12 | void VerifyDriveGeometry::geometryOkay(uint64_t bytes) |
| 13 | { |
| 14 | if (bytes > ERASE_MAX_GEOMETRY) |
| 15 | { |
| 16 | lg2::error("Erase verify Geometry too large", "REDFISH_MESSAGE_ID", |
| 17 | std::string("OpenBMC.0.1.DriveEraseFailure"), |
| 18 | "REDFISH_MESSAGE_ARGS", |
| 19 | std::to_string(bytes) + ">" + |
| 20 | std::to_string(ERASE_MAX_GEOMETRY)); |
John Wedig | 972c3fa | 2021-12-29 17:30:41 -0800 | [diff] [blame^] | 21 | throw InternalFailure(); |
John Edward Broadbent | e6ffe70 | 2021-10-14 14:03:11 -0700 | [diff] [blame] | 22 | } |
| 23 | else if (bytes < ERASE_MIN_GEOMETRY) |
| 24 | { |
| 25 | lg2::error( |
| 26 | "eStorageD erase verify Geometry too small", "REDFISH_MESSAGE_ID", |
| 27 | std::string("OpenBMC.0.1.DriveEraseFailure"), |
| 28 | "REDFISH_MESSAGE_ARGS", |
| 29 | std::to_string(bytes) + "<" + std::to_string(ERASE_MIN_GEOMETRY)); |
John Wedig | 972c3fa | 2021-12-29 17:30:41 -0800 | [diff] [blame^] | 30 | throw InternalFailure(); |
John Edward Broadbent | e6ffe70 | 2021-10-14 14:03:11 -0700 | [diff] [blame] | 31 | } |
| 32 | else |
| 33 | { |
| 34 | lg2::info("eStorageD erase verify Geometry in range", |
| 35 | "REDFISH_MESSAGE_ID", |
| 36 | std::string("OpenBMC.0.1.DriveEraseSuccess")); |
| 37 | } |
| 38 | } |