PNOR: Implement Software RedundancyPriority.interface
- Create Redundancy Priority interface after a successful
PNOR update and set the priority.
- Remove Redundancy Priority interface once the activation
state changes from being Active
Change-Id: If4fdb466d3e0319b57a381c80e25457d689b8785
Signed-off-by: Saqib Khan <khansa@us.ibm.com>
diff --git a/activation.cpp b/activation.cpp
index 81aa5e7..58819c0 100755
--- a/activation.cpp
+++ b/activation.cpp
@@ -15,6 +15,12 @@
auto Activation::activation(Activations value) ->
Activations
{
+
+ if (value != softwareServer::Activation::Activations::Active)
+ {
+ redundancyPriority.reset(nullptr);
+ }
+
if (value == softwareServer::Activation::Activations::Activating)
{
softwareServer::Activation::activation(value);
@@ -77,6 +83,15 @@
fs::create_directory_symlink(PNOR_PRSV, PNOR_PRSV_ACTIVE_PATH);
}
+ // Set Redundancy Priority before setting to Active
+ if (!redundancyPriority)
+ {
+ redundancyPriority =
+ std::make_unique<RedundancyPriority>(
+ bus,
+ path);
+ }
+
return softwareServer::Activation::activation(
softwareServer::Activation::Activations::Active);
}