summaryrefslogtreecommitdiffstats
path: root/ubi/activation_ubi.hpp
blob: a6ef436c130cbc138486ca4efd8ed35e12eb23ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once

#include "activation.hpp"

namespace openpower
{
namespace software
{
namespace updater
{

constexpr auto squashFSImage = "pnor.xz.squashfs";

class RedundancyPriorityUbi : public RedundancyPriority
{
  public:
    RedundancyPriorityUbi(sdbusplus::bus::bus& bus, const std::string& path,
                          Activation& parent, uint8_t value) :
        RedundancyPriority(bus, path, parent, value)
    {
        priority(value);
    }
    virtual ~RedundancyPriorityUbi() = default;

    /** @brief Overloaded Priority property set function
     *
     *  @param[in] value - uint8_t
     *
     *  @return Success or exception thrown
     */
    uint8_t priority(uint8_t value) override;
};

/** @class ActivationUbi
 *  @brief OpenBMC activation software management implementation.
 *  @details A concrete implementation for
 *  xyz.openbmc_project.Software.Activation DBus API.
 */
class ActivationUbi : public Activation
{
  public:
    using Activation::Activation;
    virtual ~ActivationUbi() = default;

    /** @brief Overloaded Activation property setter function
     *
     *  @param[in] value - One of Activation::Activations
     *
     *  @return Success or exception thrown
     */
    Activations activation(Activations value) override;

    RequestedActivations
        requestedActivation(RequestedActivations value) override;

  private:
    /** @brief Tracks whether the read-only & read-write volumes have been
     *created as part of the activation process. **/
    bool ubiVolumesCreated = false;

    void unitStateChange(sdbusplus::message::message& msg) override;
    void startActivation() override;
    void finishActivation() override;
};

} // namespace updater
} // namespace software
} // namespace openpower
OpenPOWER on IntegriCloud