Lei YU | 322f3f4 | 2019-02-21 16:10:41 +0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "item_updater.hpp" |
| 4 | |
| 5 | namespace openpower |
| 6 | { |
| 7 | namespace software |
| 8 | { |
| 9 | namespace updater |
| 10 | { |
| 11 | |
| 12 | /** @class ItemUpdaterStatic |
| 13 | * @brief Manages the activation of the host version items for static layout |
| 14 | */ |
| 15 | class ItemUpdaterStatic : public ItemUpdater |
| 16 | { |
| 17 | public: |
| 18 | ItemUpdaterStatic(sdbusplus::bus::bus& bus, const std::string& path) : |
| 19 | ItemUpdater(bus, path) |
| 20 | { |
| 21 | processPNORImage(); |
| 22 | gardReset = std::make_unique<GardReset>(bus, GARD_PATH); |
| 23 | volatileEnable = std::make_unique<ObjectEnable>(bus, volatilePath); |
| 24 | |
| 25 | // Emit deferred signal. |
| 26 | emit_object_added(); |
| 27 | } |
| 28 | virtual ~ItemUpdaterStatic() = default; |
| 29 | |
| 30 | void freePriority(uint8_t value, const std::string& versionId) override; |
| 31 | |
| 32 | void processPNORImage() override; |
| 33 | |
| 34 | void deleteAll() override; |
| 35 | |
| 36 | void freeSpace() override; |
| 37 | |
Lei YU | a2e6716 | 2019-02-22 17:35:24 +0800 | [diff] [blame^] | 38 | void updateFunctionalAssociation(const std::string& versionId) override; |
| 39 | |
Lei YU | 322f3f4 | 2019-02-21 16:10:41 +0800 | [diff] [blame] | 40 | bool isVersionFunctional(const std::string& versionId) override; |
| 41 | |
| 42 | private: |
| 43 | /** @brief Create Activation object */ |
| 44 | std::unique_ptr<Activation> createActivationObject( |
| 45 | const std::string& path, const std::string& versionId, |
| 46 | const std::string& extVersion, |
| 47 | sdbusplus::xyz::openbmc_project::Software::server::Activation:: |
| 48 | Activations activationStatus, |
| 49 | AssociationList& assocs) override; |
| 50 | |
| 51 | /** @brief Create Version object */ |
| 52 | std::unique_ptr<Version> |
| 53 | createVersionObject(const std::string& objPath, |
| 54 | const std::string& versionId, |
| 55 | const std::string& versionString, |
| 56 | sdbusplus::xyz::openbmc_project::Software::server:: |
| 57 | Version::VersionPurpose versionPurpose, |
| 58 | const std::string& filePath) override; |
| 59 | |
| 60 | /** @brief Validate if image is valid or not */ |
| 61 | bool validateImage(const std::string& path); |
| 62 | |
| 63 | /** @brief Host factory reset - clears PNOR partitions for each |
| 64 | * Activation D-Bus object */ |
| 65 | void reset() override; |
Lei YU | a2e6716 | 2019-02-22 17:35:24 +0800 | [diff] [blame^] | 66 | |
| 67 | /** @brief The functional version ID */ |
| 68 | std::string functionalVersionId; |
Lei YU | 322f3f4 | 2019-02-21 16:10:41 +0800 | [diff] [blame] | 69 | }; |
| 70 | |
| 71 | } // namespace updater |
| 72 | } // namespace software |
| 73 | } // namespace openpower |