summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-Adding-StandBySpare-for-firmware-activation.patch
blob: 6039be44b84e6f5c776a2964d3f1cce955b4c6d9 (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
69
70
71
72
73
74
75
76
From c2ae3ac444f7a5e9674a82f47086874f947bcec6 Mon Sep 17 00:00:00 2001
From: Vikram Bodireddy <vikram.bodireddy@linux.intel.com>
Date: Thu, 5 Dec 2019 12:38:21 +0530
Subject: [PATCH]  Adding StandBySpare for firmware activation

Added new states 'StandBySpare', 'ActivatingAsStandbySpare' for
firmware activation. If the uploaded firmware image is for
backup/recovery, then it sets the "StandBySpare" value for
Activations. When backup/recovery image is in activating state,
then activations will be set to "ActivatingAsStandbySpare".

Tested:
Tested using redfish interface.
Did the GET on "/redfish/v1/UpdateService/FirmwareInventory/<backup image>"
Response:
    ....
    "Status": {
         "Health": "OK",
         "HealthRollup": "OK",
         "State": "StandbySpare"
    }
.......

Change-Id: I7f1608fac3196774a6d593b6128d58da3f5c88fc
Signed-off-by: Vikram Bodireddy <vikram.bodireddy@linux.intel.com>
---
 activation.cpp | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/activation.cpp b/activation.cpp
index 2966b2f..a098784 100644
--- a/activation.cpp
+++ b/activation.cpp
@@ -81,12 +81,16 @@ void Activation::unsubscribeFromSystemdSignals()
 auto Activation::activation(Activations value) -> Activations
 {
     if ((value != softwareServer::Activation::Activations::Active) &&
-        (value != softwareServer::Activation::Activations::Activating))
+        (value != softwareServer::Activation::Activations::Activating) &&
+        (value !=
+         softwareServer::Activation::Activations::ActivatingAsStandbySpare))
     {
         redundancyPriority.reset(nullptr);
     }
 
-    if (value == softwareServer::Activation::Activations::Activating)
+    if (value == softwareServer::Activation::Activations::Activating ||
+        value ==
+            softwareServer::Activation::Activations::ActivatingAsStandbySpare)
     {
 #ifdef FWUPD_SCRIPT
         if (!activationProgress)
@@ -309,6 +313,20 @@ auto Activation::requestedActivation(RequestedActivations value)
                 softwareServer::Activation::Activations::Activating);
         }
     }
+    else if ((value ==
+              softwareServer::Activation::RequestedActivations::StandbySpare) &&
+             (softwareServer::Activation::requestedActivation() !=
+              softwareServer::Activation::RequestedActivations::StandbySpare))
+    {
+        if ((softwareServer::Activation::activation() ==
+             softwareServer::Activation::Activations::Ready) ||
+            (softwareServer::Activation::activation() ==
+             softwareServer::Activation::Activations::Failed))
+        {
+            Activation::activation(softwareServer::Activation::Activations::
+                                       ActivatingAsStandbySpare);
+        }
+    }
     return softwareServer::Activation::requestedActivation(value);
 }
 
-- 
2.7.4