diff options
author | Jason M. Bills <jason.m.bills@linux.intel.com> | 2020-08-04 01:40:26 +0300 |
---|---|---|
committer | Jason M. Bills <jason.m.bills@linux.intel.com> | 2020-08-04 23:23:32 +0300 |
commit | 40108db4434d8c2e0a1ad2d1dd3f5ae34b17352c (patch) | |
tree | 14edb2241a48b600f217aa8ebc03a59ed62ca268 /meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0001-Add-more-error-types.patch | |
parent | d071adf43ac87f21dde2f84287120960c723962c (diff) | |
download | openbmc-40108db4434d8c2e0a1ad2d1dd3f5ae34b17352c.tar.xz |
Update to internal 0.72
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0001-Add-more-error-types.patch')
-rw-r--r-- | meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0001-Add-more-error-types.patch | 459 |
1 files changed, 459 insertions, 0 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0001-Add-more-error-types.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0001-Add-more-error-types.patch new file mode 100644 index 000000000..d43256bf4 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0001-Add-more-error-types.patch @@ -0,0 +1,459 @@ +From e710df3123c382fc735c451a048f7c51250c1a92 Mon Sep 17 00:00:00 2001 +From: James Feist <james.feist@linux.intel.com> +Date: Thu, 11 Jun 2020 13:14:11 -0700 +Subject: [PATCH 1/2] Add more error types + +This adds ImageFailure and Busy error types +to updates status in bmcweb. + +elog-errors.hpp is a generated file. + +Tested: Could create errors + +Signed-off-by: James Feist <james.feist@linux.intel.com> +--- + elog-errors.hpp | 269 ++++++++++++------ + .../Software/Image.errors.yaml | 5 + + .../Software/Image.metadata.yaml | 11 + + 3 files changed, 204 insertions(+), 81 deletions(-) + +diff --git a/elog-errors.hpp b/elog-errors.hpp +index 2888f0d..38016e1 100644 +--- a/elog-errors.hpp ++++ b/elog-errors.hpp +@@ -2,12 +2,12 @@ + // See elog-gen.py for more details + #pragma once + +-#include <phosphor-logging/elog.hpp> +-#include <phosphor-logging/log.hpp> +-#include <sdbusplus/exception.hpp> + #include <string> + #include <tuple> + #include <type_traits> ++#include <sdbusplus/exception.hpp> ++#include <phosphor-logging/log.hpp> ++#include <phosphor-logging/elog.hpp> + + namespace sdbusplus + { +@@ -21,7 +21,7 @@ namespace Image + { + namespace Error + { +-struct UnTarFailure; ++ struct InternalFailure; + } // namespace Error + } // namespace Image + } // namespace Software +@@ -41,7 +41,7 @@ namespace Image + { + namespace Error + { +-struct InternalFailure; ++ struct UnTarFailure; + } // namespace Error + } // namespace Image + } // namespace Software +@@ -61,7 +61,7 @@ namespace Image + { + namespace Error + { +-struct ManifestFileFailure; ++ struct BusyFailure; + } // namespace Error + } // namespace Image + } // namespace Software +@@ -69,6 +69,47 @@ struct ManifestFileFailure; + } // namespace xyz + } // namespace sdbusplus + ++namespace sdbusplus ++{ ++namespace xyz ++{ ++namespace openbmc_project ++{ ++namespace Software ++{ ++namespace Image ++{ ++namespace Error ++{ ++ struct ImageFailure; ++} // namespace Error ++} // namespace Image ++} // namespace Software ++} // namespace openbmc_project ++} // namespace xyz ++} // namespace sdbusplus ++ ++namespace sdbusplus ++{ ++namespace xyz ++{ ++namespace openbmc_project ++{ ++namespace Software ++{ ++namespace Image ++{ ++namespace Error ++{ ++ struct ManifestFileFailure; ++} // namespace Error ++} // namespace Image ++} // namespace Software ++} // namespace openbmc_project ++} // namespace xyz ++} // namespace sdbusplus ++ ++ + namespace phosphor + { + +@@ -88,38 +129,25 @@ namespace _UnTarFailure + + struct PATH + { +- static constexpr auto str = "PATH=%s"; ++ /* ++ * We can't use -fsanitize=undefined if we declare a ++ * 'static constexpr auto str' member, so don't. Instead, open-code the ++ * mako template lookups. ++ */ + static constexpr auto str_short = "PATH"; +- using type = std::tuple<std::decay_t<decltype(str)>, const char*>; +- explicit constexpr PATH(const char* a) : _entry(entry(str, a)){}; ++ using type = std::tuple<std::decay_t<decltype("PATH=%s")>,const char*>; ++ explicit constexpr PATH(const char* a) : _entry(entry("PATH=%s", a)) {}; + type _entry; + }; + +-} // namespace _UnTarFailure ++} // namespace _UnTarFailure + +-struct UnTarFailure : public sdbusplus::exception_t ++struct UnTarFailure + { +- static constexpr auto errName = +- "xyz.openbmc_project.Software.Image.UnTarFailure"; +- static constexpr auto errDesc = "An error occurred during untar."; + static constexpr auto L = level::ERR; + using PATH = _UnTarFailure::PATH; + using metadata_types = std::tuple<PATH>; + +- const char* name() const noexcept +- { +- return errName; +- } +- +- const char* description() const noexcept +- { +- return errDesc; +- } +- +- const char* what() const noexcept +- { +- return errName; +- } + }; + + } // namespace Image +@@ -127,16 +155,17 @@ struct UnTarFailure : public sdbusplus::exception_t + } // namespace openbmc_project + } // namespace xyz + ++ + namespace details + { + + template <> +-struct map_exception_type< +- sdbusplus::xyz::openbmc_project::Software::Image::Error::UnTarFailure> ++struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image::Error::UnTarFailure> + { + using type = xyz::openbmc_project::Software::Image::UnTarFailure; + }; +-} // namespace details ++ ++} + + namespace xyz + { +@@ -151,38 +180,25 @@ namespace _ManifestFileFailure + + struct PATH + { +- static constexpr auto str = "PATH=%s"; ++ /* ++ * We can't use -fsanitize=undefined if we declare a ++ * 'static constexpr auto str' member, so don't. Instead, open-code the ++ * mako template lookups. ++ */ + static constexpr auto str_short = "PATH"; +- using type = std::tuple<std::decay_t<decltype(str)>, const char*>; +- explicit constexpr PATH(const char* a) : _entry(entry(str, a)){}; ++ using type = std::tuple<std::decay_t<decltype("PATH=%s")>,const char*>; ++ explicit constexpr PATH(const char* a) : _entry(entry("PATH=%s", a)) {}; + type _entry; + }; + +-} // namespace _ManifestFileFailure ++} // namespace _ManifestFileFailure + +-struct ManifestFileFailure : public sdbusplus::exception_t ++struct ManifestFileFailure + { +- static constexpr auto errName = +- "xyz.openbmc_project.Software.Image.ManifestFileFailure"; +- static constexpr auto errDesc = "An error when reading the Manifest file."; + static constexpr auto L = level::ERR; + using PATH = _ManifestFileFailure::PATH; + using metadata_types = std::tuple<PATH>; + +- const char* name() const noexcept +- { +- return errName; +- } +- +- const char* description() const noexcept +- { +- return errDesc; +- } +- +- const char* what() const noexcept +- { +- return errName; +- } + }; + + } // namespace Image +@@ -190,16 +206,17 @@ struct ManifestFileFailure : public sdbusplus::exception_t + } // namespace openbmc_project + } // namespace xyz + ++ + namespace details + { + + template <> +-struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image:: +- Error::ManifestFileFailure> ++struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image::Error::ManifestFileFailure> + { + using type = xyz::openbmc_project::Software::Image::ManifestFileFailure; + }; +-} // namespace details ++ ++} + + namespace xyz + { +@@ -214,39 +231,76 @@ namespace _InternalFailure + + struct FAIL + { +- static constexpr auto str = "FAIL=%s"; ++ /* ++ * We can't use -fsanitize=undefined if we declare a ++ * 'static constexpr auto str' member, so don't. Instead, open-code the ++ * mako template lookups. ++ */ + static constexpr auto str_short = "FAIL"; +- using type = std::tuple<std::decay_t<decltype(str)>, const char*>; +- explicit constexpr FAIL(const char* a) : _entry(entry(str, a)){}; ++ using type = std::tuple<std::decay_t<decltype("FAIL=%s")>,const char*>; ++ explicit constexpr FAIL(const char* a) : _entry(entry("FAIL=%s", a)) {}; + type _entry; + }; + +-} // namespace _InternalFailure ++} // namespace _InternalFailure + +-struct InternalFailure : public sdbusplus::exception_t ++struct InternalFailure + { +- static constexpr auto errName = +- "xyz.openbmc_project.Software.Image.InternalFailure"; +- static constexpr auto errDesc = +- "The operation failed internally during processing the image."; + static constexpr auto L = level::ERR; + using FAIL = _InternalFailure::FAIL; + using metadata_types = std::tuple<FAIL>; + +- const char* name() const noexcept +- { +- return errName; +- } ++}; ++ ++} // namespace Image ++} // namespace Software ++} // namespace openbmc_project ++} // namespace xyz ++ ++ ++namespace details ++{ ++ ++template <> ++struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image::Error::InternalFailure> ++{ ++ using type = xyz::openbmc_project::Software::Image::InternalFailure; ++}; ++ ++} + +- const char* description() const noexcept +- { +- return errDesc; +- } ++namespace xyz ++{ ++namespace openbmc_project ++{ ++namespace Software ++{ ++namespace Image ++{ ++namespace _ImageFailure ++{ ++ ++struct PATH ++{ ++ /* ++ * We can't use -fsanitize=undefined if we declare a ++ * 'static constexpr auto str' member, so don't. Instead, open-code the ++ * mako template lookups. ++ */ ++ static constexpr auto str_short = "PATH"; ++ using type = std::tuple<std::decay_t<decltype("PATH=%s")>,const char*>; ++ explicit constexpr PATH(const char* a) : _entry(entry("PATH=%s", a)) {}; ++ type _entry; ++}; ++ ++} // namespace _ImageFailure ++ ++struct ImageFailure ++{ ++ static constexpr auto L = level::ERR; ++ using PATH = _ImageFailure::PATH; ++ using metadata_types = std::tuple<PATH>; + +- const char* what() const noexcept +- { +- return errName; +- } + }; + + } // namespace Image +@@ -254,16 +308,69 @@ struct InternalFailure : public sdbusplus::exception_t + } // namespace openbmc_project + } // namespace xyz + ++ + namespace details + { + + template <> +-struct map_exception_type< +- sdbusplus::xyz::openbmc_project::Software::Image::Error::InternalFailure> ++struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image::Error::ImageFailure> + { +- using type = xyz::openbmc_project::Software::Image::InternalFailure; ++ using type = xyz::openbmc_project::Software::Image::ImageFailure; + }; +-} // namespace details ++ ++} ++ ++namespace xyz ++{ ++namespace openbmc_project ++{ ++namespace Software ++{ ++namespace Image ++{ ++namespace _BusyFailure ++{ ++ ++struct PATH ++{ ++ /* ++ * We can't use -fsanitize=undefined if we declare a ++ * 'static constexpr auto str' member, so don't. Instead, open-code the ++ * mako template lookups. ++ */ ++ static constexpr auto str_short = "PATH"; ++ using type = std::tuple<std::decay_t<decltype("PATH=%s")>,const char*>; ++ explicit constexpr PATH(const char* a) : _entry(entry("PATH=%s", a)) {}; ++ type _entry; ++}; ++ ++} // namespace _BusyFailure ++ ++struct BusyFailure ++{ ++ static constexpr auto L = level::ERR; ++ using PATH = _BusyFailure::PATH; ++ using metadata_types = std::tuple<PATH>; ++ ++}; ++ ++} // namespace Image ++} // namespace Software ++} // namespace openbmc_project ++} // namespace xyz ++ ++ ++namespace details ++{ ++ ++template <> ++struct map_exception_type<sdbusplus::xyz::openbmc_project::Software::Image::Error::BusyFailure> ++{ ++ using type = xyz::openbmc_project::Software::Image::BusyFailure; ++}; ++ ++} ++ + + } // namespace logging + +diff --git a/xyz/openbmc_project/Software/Image.errors.yaml b/xyz/openbmc_project/Software/Image.errors.yaml +index 67d6c20..2b8f7ee 100644 +--- a/xyz/openbmc_project/Software/Image.errors.yaml ++++ b/xyz/openbmc_project/Software/Image.errors.yaml +@@ -4,3 +4,8 @@ + description: An error when reading the Manifest file. + - name: InternalFailure + description: The operation failed internally during processing the image. ++- name: ImageFailure ++ description: An error occured processing the image. ++- name: BusyFailure ++ description: The device is busy during the update. ++ +diff --git a/xyz/openbmc_project/Software/Image.metadata.yaml b/xyz/openbmc_project/Software/Image.metadata.yaml +index 5e749c9..65d4e1c 100644 +--- a/xyz/openbmc_project/Software/Image.metadata.yaml ++++ b/xyz/openbmc_project/Software/Image.metadata.yaml +@@ -13,3 +13,14 @@ + meta: + - str: "FAIL=%s" + type: string ++- name: ImageFailure ++ level: ERR ++ meta: ++ - str: "PATH=%s" ++ type: string ++- name: BusyFailure ++ level: ERR ++ meta: ++ - str: "PATH=%s" ++ type: string ++ +-- +2.17.1 + |