Log vpd write action to file
This commit implements changes to log VPD write action to file.
VPD WriteKeyword API is exposed on DBus and can be triggered by any
application. VPD write also has the potential to corrupt data in some
cases. Hence all VPD write actions need to be logged. This commit also
implements an utility API to convert WriteVpdParams to string data type.
Test:
```
- execute vpd-tool writeKeyword on Op Panel's VINI record, CC keyword
- observe vpd-tool writeKeyword is successful and following log entry is
added in /var/lib/vpd/vpdWrite.log
2025-09-18 08:17:02.367 [Info] FileName: /usr/src/debug/openpower-fru-vpd
/1.0+git/vpd-manager/src/manager.cpp, Line: 277 VPD write successful on
path[/xyz/openbmc_project/inventory/system/chassis/motherboard/tpm_wilson
] : Record: VINI Keyword: CC Value: 0x36423630
- execute vpd-tool writeKeyword with invalid Keyword, observe no new log
added to /var/lib/vpd/vpdWrite.log
```
Change-Id: I209d761d3504dea6a1b65577fb4f3ee548c8adf6
Signed-off-by: Souvik Roy <souvikroyofficial10@gmail.com>
diff --git a/vpd-manager/include/error_codes.hpp b/vpd-manager/include/error_codes.hpp
index cea46f1..e0d8eeb 100644
--- a/vpd-manager/include/error_codes.hpp
+++ b/vpd-manager/include/error_codes.hpp
@@ -29,7 +29,11 @@
DEVICE_NOT_PRESENT,
DEVICE_PRESENCE_UNKNOWN,
GPIO_LINE_EXCEPTION,
- ERROR_PROCESSING_SYSTEM_CMD
+ ERROR_PROCESSING_SYSTEM_CMD,
+ STANDARD_EXCEPTION,
+
+ // VPD specific errors
+ UNSUPPORTED_VPD_TYPE
};
const std::unordered_map<int, std::string> errorCodeMap = {
@@ -58,5 +62,7 @@
{error_code::DEVICE_PRESENCE_UNKNOWN, "Exception on presence line GPIO."},
{error_code::GPIO_LINE_EXCEPTION, "There was an exception in GPIO line."},
{error_code::ERROR_PROCESSING_SYSTEM_CMD,
- "Error while executing system command tag."}};
+ "Error while executing system command tag."},
+ {error_code::UNSUPPORTED_VPD_TYPE, "This VPD type is not supported"},
+ {error_code::STANDARD_EXCEPTION, "Standard Exception thrown"}};
} // namespace vpd