blob: c3f273d37ecad5f6c56e27c625906ba734333384 [file] [log] [blame]
Lei YU322f3f42019-02-21 16:10:41 +08001#pragma once
2
3#include "item_updater.hpp"
4
5namespace openpower
6{
7namespace software
8{
9namespace updater
10{
11
12/** @class ItemUpdaterStatic
13 * @brief Manages the activation of the host version items for static layout
14 */
15class 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
Lei YU6da3dae2019-02-28 14:26:37 +080036 bool freeSpace() override;
Lei YU322f3f42019-02-21 16:10:41 +080037
Lei YUa2e67162019-02-22 17:35:24 +080038 void updateFunctionalAssociation(const std::string& versionId) override;
39
Lei YU322f3f42019-02-21 16:10:41 +080040 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 YUa2e67162019-02-22 17:35:24 +080066
67 /** @brief The functional version ID */
68 std::string functionalVersionId;
Lei YU322f3f42019-02-21 16:10:41 +080069};
70
71} // namespace updater
72} // namespace software
73} // namespace openpower