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/meson.build b/service_files/meson.build
index 2df30e6..87659ca 100644
--- a/service_files/meson.build
+++ b/service_files/meson.build
@@ -7,7 +7,7 @@
'phosphor-reset-host-running@.service',
'phosphor-reset-sensor-states@.service',
'xyz.openbmc_project.State.BMC.service',
- 'xyz.openbmc_project.State.Chassis.service',
+ 'xyz.openbmc_project.State.Chassis@.service',
'xyz.openbmc_project.State.Host@.service',
'xyz.openbmc_project.State.Hypervisor.service',
'xyz.openbmc_project.State.ScheduledHostTransition.service',
diff --git a/service_files/xyz.openbmc_project.State.Chassis.service b/service_files/xyz.openbmc_project.State.Chassis.service
deleted file mode 100644
index 7594c48..0000000
--- a/service_files/xyz.openbmc_project.State.Chassis.service
+++ /dev/null
@@ -1,17 +0,0 @@
-[Unit]
-Description=Phosphor Chassis State Manager
-Before=mapper-wait@-xyz-openbmc_project-state-chassis.service
-Wants=obmc-mapper.target
-After=obmc-mapper.target
-After=org.openbmc.control.Power@0.service
-Wants=xyz.openbmc_project.Logging.service
-After=xyz.openbmc_project.Logging.service
-
-[Service]
-ExecStart=/usr/bin/phosphor-chassis-state-manager
-Restart=always
-Type=dbus
-BusName=xyz.openbmc_project.State.Chassis
-
-[Install]
-WantedBy=multi-user.target
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