phosphor-state-manager: Support multi-host for persist files
phosphor-host-state-manager and phosphor-chassis-state-manager store
informations in files then restore that on service starting.
Since state-managers already change to multi-host now, information
should store into different files from each service instance.
forbackward capability, if there are legacy persist file exist,
rename it to the new file format of instance ;0',i.e, rename files:
'requestedHostTransition' to 'host0-PersistData',
'POHCounter' to 'chassis-POHCounter',
'chassisStateChangeTime' to 'chassis0-StateChangeTime'
Changes:
a.phosphor-host-state-manager:
'/var/lib/phosphor-state-manager/requestedHostTransition'
this file not only store requestedHostTransition now,
rename to PersistData and add host-N prefix for each service.
For example, bus xyz.openbmc_project.State.Host1 store data to
'/var/lib/phosphor-state-manager/host1-PersistData'
xyz.openbmc_project.State.Host2 store date to
'/var/lib/phosphor-state-manager/host2-PersistData'
b.phosphor-chassis-state-manager:
There are two files to store informations
'/var/lib/phosphor-state-manager/POHCounter',
'/var/lib/phosphor-state-manager/chassisStateChangeTime'
change to:
'/var/lib/phosphor-state-manager/chassis1-POHCounter',
'/var/lib/phosphor-state-manager/chassis2-POHCounter'
...
'/var/lib/phosphor-state-manager/chassis1-StateChangeTime'
'/var/lib/phosphor-state-manager/chassis2-StateChangeTime'
... for each service.
Tested on Bletchley HW,
set xyz.openbmc_project.State.Host1 RequestedHostTransition to On
'busctl set-property xyz.openbmc_project.State.Host1 /xyz/openbmc_project/state/host1
xyz.openbmc_project.State.Host RequestedHostTransition s "xyz.openbmc_project.State.Host.Transition.On"'
This request will store in file:
'cat /var/lib/phosphor-state-manager/host1-PersistData'
{
"value0": {
"cereal_class_version": 1,
"value0": "xyz.openbmc_project.State.Host.Transition.On",
"value1": "xyz.openbmc_project.State.Boot.Progress.ProgressStages.Unspecified",
"value2": "xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Inactive"
}
restart xyz.openbmc_project.State.Host1~Host6 or reboot BMC, 'RequestedHostTransition' for host1 still "On"
'busctl get-property xyz.openbmc_project.State.Host1 /xyz/openbmc_project/state/host1
xyz.openbmc_project.State.Host RequestedHostTransition'
s "xyz.openbmc_project.State.Host.Transition.On"
'RequestedHostTransition' of the rest 5 Hosts are default value "xyz.openbmc_project.State.Host.Transition.Off"
Also, set POHCounter of xyz.openbmc_project.State.Chassis2
'busctl set-property xyz.openbmc_project.State.Chassis2 /xyz/openbmc_project/state/chassis2
xyz.openbmc_project.State.PowerOnHours POHCounter u 5'
it will restore after service restart or BMC reboot,
'busctl get-property xyz.openbmc_project.State.Chassis2 /xyz/openbmc_project/state/chassis2
xyz.openbmc_project.State.PowerOnHours POHCounter'
u 5
Change-Id: I739c62707bb805e7c25f399a2fea06beee5543a0
Signed-off-by: Allen.Wang <Allen_Wang@quantatw.com>
diff --git a/meson_options.txt b/meson_options.txt
index 8592d1d..f042b64 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -50,20 +50,20 @@
option(
'host-state-persist-path', type: 'string',
- value: '/var/lib/phosphor-state-manager/requestedHostTransition',
- description: 'Path of file for storing requested host state.',
+ value: '/var/lib/phosphor-state-manager/host{}-PersistData',
+ description: 'Path format of file for storing requested HostState,boot progress and os status.',
)
option(
'poh-counter-persist-path', type: 'string',
- value: '/var/lib/phosphor-state-manager/POHCounter',
- description: 'Path of file for storing POH counter.',
+ value: '/var/lib/phosphor-state-manager/chassis{}-POHCounter',
+ description: 'Path format of file for storing POH counter.',
)
option(
'chassis-state-change-persist-path', type: 'string',
- value: '/var/lib/phosphor-state-manager/chassisStateChangeTime',
- description: 'Path of file for storing the state change time.',
+ value: '/var/lib/phosphor-state-manager/chassis{}-StateChangeTime',
+ description: 'Path format of file for storing the state change time.',
)
option(