chassis-state-manager: Add multi-chassis support
Add multi-chassis management support, each chassis bus separates by
giving a unique chassis id.
Current code only support single chassis, and alway assume bus name is
"xyz.openbmc_project.State.Chassis".
This patch allow user to launch chassis-state-manager with a chassis id,
and chassis id is added into service bus name for identification.
Because there are many places hardcode with bus name
"xyz.openbmc_project.State.Chassis", if chassis id is 0,
chassis-state-manager will request both
"xyz.openbmc_project.State.Chassis" and
"xyz.openbmc_project.State.Chassis0" bus name to meet backwards
compatibility.
Tested on Bletchley:
root@bletchley:~# busctl tree xyz.openbmc_project.State.Chassis
`-/xyz
`-/xyz/openbmc_project
`-/xyz/openbmc_project/state
`-/xyz/openbmc_project/state/chassis0
root@bletchley:~# busctl tree xyz.openbmc_project.State.Chassis0
`-/xyz
`-/xyz/openbmc_project
`-/xyz/openbmc_project/state
`-/xyz/openbmc_project/state/chassis0
root@bletchley:~# busctl tree xyz.openbmc_project.State.Chassis1
`-/xyz
`-/xyz/openbmc_project
`-/xyz/openbmc_project/state
`-/xyz/openbmc_project/state/chassis1
......
patch dependencies:
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-state-manager/+/51465
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I2ce3e9ab2c95a2688143f4e3775da164a5c33c19
diff --git a/service_files/xyz.openbmc_project.State.Chassis@.service b/service_files/xyz.openbmc_project.State.Chassis@.service
new file mode 100644
index 0000000..5f4796c
--- /dev/null
+++ b/service_files/xyz.openbmc_project.State.Chassis@.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Phosphor Chassis%i State Manager
+Before=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
+Wants=obmc-mapper.target
+After=obmc-mapper.target
+After=org.openbmc.control.Power@%i.service
+Wants=xyz.openbmc_project.Logging.service
+After=xyz.openbmc_project.Logging.service
+
+[Service]
+ExecStart=/usr/bin/phosphor-chassis-state-manager --chassis %i
+Restart=always
+Type=dbus
+BusName=xyz.openbmc_project.State.Chassis%i
+
+[Install]
+WantedBy=multi-user.target