API to detect powerVS image
PowerVS systems mandate running of image with specific prefix.
The commit adds API to check for those prefix and confirm if it is a
powerVS image or not.
Change-Id: Ie1cb012d57068d77fbfeeb2cbd6e4e54a542d32f
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
diff --git a/vpd-manager/include/utility/vpd_specific_utility.hpp b/vpd-manager/include/utility/vpd_specific_utility.hpp
index fbf713b..a371878 100644
--- a/vpd-manager/include/utility/vpd_specific_utility.hpp
+++ b/vpd-manager/include/utility/vpd_specific_utility.hpp
@@ -783,5 +783,24 @@
return std::string{};
}
}
+
+/**
+ * @brief API to check if the current running image is a powerVS image.
+ *
+ * @return true if it is PowerVS image, false otherwise.
+ */
+inline bool isPowerVsImage()
+{
+ std::string l_imagePrefix = dbusUtility::getImagePrefix();
+
+ if ((l_imagePrefix == constants::powerVsImagePrefix_MY) ||
+ (l_imagePrefix == constants::powerVsImagePrefix_NY) ||
+ (l_imagePrefix == constants::powerVsImagePrefix_MZ) ||
+ (l_imagePrefix == constants::powerVsImagePrefix_NZ))
+ {
+ return true;
+ }
+ return false;
+}
} // namespace vpdSpecificUtility
} // namespace vpd