summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLei YU <mine260309@gmail.com>2019-02-22 11:38:40 +0800
committerLei YU <mine260309@gmail.com>2019-03-13 11:01:53 +0800
commitb53425d44b49fc494750d46a1fe4050ecd3db434 (patch)
treeb84885cad5f831777b1efc84209651e3564097ae
parentdec8cf9c11e7f34be9b50fd45e85bec9187cf1d0 (diff)
downloadopenpower-pnor-code-mgmt-b53425d44b49fc494750d46a1fe4050ecd3db434.tar.gz
openpower-pnor-code-mgmt-b53425d44b49fc494750d46a1fe4050ecd3db434.zip
Static layout: Add dummy activation_static
Add ActivationStatic inherits Activation, which will be used to do PNOR code update for statis layout. Tested: Verify code compiles. Change-Id: I5d90c84b63797e37fa309caeb9b23035f3c76f9f Signed-off-by: Lei YU <mine260309@gmail.com>
-rw-r--r--static/Makefile.am.include3
-rw-r--r--static/activation_static.cpp25
-rw-r--r--static/activation_static.hpp29
-rw-r--r--static/item_updater_static.cpp27
4 files changed, 80 insertions, 4 deletions
diff --git a/static/Makefile.am.include b/static/Makefile.am.include
index 827e2fde1..126907f6d 100644
--- a/static/Makefile.am.include
+++ b/static/Makefile.am.include
@@ -1,2 +1,3 @@
openpower_update_manager_SOURCES += \
- %reldir%/item_updater_static.cpp
+ %reldir%/item_updater_static.cpp \
+ %reldir%/activation_static.cpp
diff --git a/static/activation_static.cpp b/static/activation_static.cpp
new file mode 100644
index 000000000..d73dc50a4
--- /dev/null
+++ b/static/activation_static.cpp
@@ -0,0 +1,25 @@
+#include "activation_static.hpp"
+
+namespace openpower
+{
+namespace software
+{
+namespace updater
+{
+namespace softwareServer = sdbusplus::xyz::openbmc_project::Software::server;
+
+void ActivationStatic::startActivation()
+{
+}
+
+void ActivationStatic::unitStateChange(sdbusplus::message::message& msg)
+{
+}
+
+void ActivationStatic::finishActivation()
+{
+}
+
+} // namespace updater
+} // namespace software
+} // namespace openpower
diff --git a/static/activation_static.hpp b/static/activation_static.hpp
new file mode 100644
index 000000000..85914ac50
--- /dev/null
+++ b/static/activation_static.hpp
@@ -0,0 +1,29 @@
+#pragma once
+
+#include "activation.hpp"
+
+namespace openpower
+{
+namespace software
+{
+namespace updater
+{
+
+/** @class ActivationStatic
+ * @brief Implementation for static PNOR layout
+ */
+class ActivationStatic : public Activation
+{
+ public:
+ using Activation::Activation;
+ ~ActivationStatic() = default;
+
+ private:
+ void unitStateChange(sdbusplus::message::message& msg) override;
+ void startActivation() override;
+ void finishActivation() override;
+};
+
+} // namespace updater
+} // namespace software
+} // namespace openpower
diff --git a/static/item_updater_static.cpp b/static/item_updater_static.cpp
index 5937e13eb..9ae2942c7 100644
--- a/static/item_updater_static.cpp
+++ b/static/item_updater_static.cpp
@@ -2,7 +2,7 @@
#include "item_updater_static.hpp"
-#include "activation.hpp"
+#include "activation_static.hpp"
#include "version.hpp"
#include <cstring>
@@ -115,7 +115,8 @@ std::unique_ptr<Activation> ItemUpdaterStatic::createActivationObject(
activationStatus,
AssociationList& assocs)
{
- return {};
+ return std::make_unique<ActivationStatic>(
+ bus, path, *this, versionId, extVersion, activationStatus, assocs);
}
std::unique_ptr<Version> ItemUpdaterStatic::createVersionObject(
@@ -125,11 +126,16 @@ std::unique_ptr<Version> ItemUpdaterStatic::createVersionObject(
versionPurpose,
const std::string& filePath)
{
- return {};
+ auto version = std::make_unique<Version>(
+ bus, objPath, *this, versionId, versionString, versionPurpose, filePath,
+ std::bind(&ItemUpdaterStatic::erase, this, std::placeholders::_1));
+ version->deleteObject = std::make_unique<Delete>(bus, objPath, *version);
+ return version;
}
bool ItemUpdaterStatic::validateImage(const std::string& path)
{
+ // There is no need to validate static layout pnor
return true;
}
@@ -170,6 +176,21 @@ void ItemUpdaterStatic::processPNORImage()
createActiveAssociation(path);
}
+ // Create Activation instance for this version.
+ activations.insert(std::make_pair(
+ id, std::make_unique<ActivationStatic>(bus, path, *this, id,
+ extendedVersion, activationState,
+ associations)));
+
+ // If Active, create RedundancyPriority instance for this version.
+ if (activationState == server::Activation::Activations::Active)
+ {
+ // For now only one PNOR is supported with static layout
+ activations.find(id)->second->redundancyPriority =
+ std::make_unique<RedundancyPriority>(
+ bus, path, *(activations.find(id)->second), 0);
+ }
+
// Create Version instance for this version.
auto versionPtr = std::make_unique<Version>(
bus, path, *this, id, version, purpose, "",
OpenPOWER on IntegriCloud