host-state-manager: Add multi-host support
Add support management multiple host state with multi process.
Each process obtain a d-bus object for corresponding host.
TESTED : Built the openbmc image for Facebook Bletchley hardware.
Verified Host State buses/objects created successfully
root@bletchley:~# busctl tree xyz.openbmc_project.State.Host1
└─/xyz
└─/xyz/openbmc_project
└─/xyz/openbmc_project/state
└─/xyz/openbmc_project/state/host1
root@bletchley:~# busctl tree xyz.openbmc_project.State.Host2
└─/xyz
└─/xyz/openbmc_project
└─/xyz/openbmc_project/state
└─/xyz/openbmc_project/state/host2
...
Built with host id 0 :
expose both Host and Host0 name to keep backwards compatibility.
'busctl |grep xyz.openbmc_project.State.Host'
...
xyz.openbmc_project.State.Host 8398 phosphor-host-s root :1.212 xyz.openbmc_project.State.Host@0.service
xyz.openbmc_project.State.Host0 8398 phosphor-host-s root :1.212 xyz.openbmc_project.State.Host@0.service
...
Signed-off-by: Allen.Wang <Allen_Wang@quantatw.com>
Change-Id: Ie18007122a5df9e33f387e691eaa9979ce18ed0e
diff --git a/service_files/meson.build b/service_files/meson.build
index 42b08db..2df30e6 100644
--- a/service_files/meson.build
+++ b/service_files/meson.build
@@ -8,7 +8,7 @@
'phosphor-reset-sensor-states@.service',
'xyz.openbmc_project.State.BMC.service',
'xyz.openbmc_project.State.Chassis.service',
- 'xyz.openbmc_project.State.Host.service',
+ 'xyz.openbmc_project.State.Host@.service',
'xyz.openbmc_project.State.Hypervisor.service',
'xyz.openbmc_project.State.ScheduledHostTransition.service',
'phosphor-clear-one-time@.service',
diff --git a/service_files/xyz.openbmc_project.State.Host.service b/service_files/xyz.openbmc_project.State.Host.service
deleted file mode 100644
index ea3a5a5..0000000
--- a/service_files/xyz.openbmc_project.State.Host.service
+++ /dev/null
@@ -1,23 +0,0 @@
-[Unit]
-Description=Phosphor Host State Manager
-Wants=mapper-wait@-xyz-openbmc_project-control-host0-auto_reboot.service
-After=mapper-wait@-xyz-openbmc_project-control-host0-auto_reboot.service
-Before=mapper-wait@-xyz-openbmc_project-state-host.service
-Wants=mapper-wait@-xyz-openbmc_project-state-chassis0.service
-After=mapper-wait@-xyz-openbmc_project-state-chassis0.service
-Wants=obmc-mapper.target
-After=obmc-mapper.target
-After=phosphor-ipmi-host.service
-After=pldmd.service
-Before=obmc-host-reset@0.target
-Wants=xyz.openbmc_project.Logging.service
-After=xyz.openbmc_project.Logging.service
-
-[Service]
-ExecStart=/usr/bin/phosphor-host-state-manager
-Restart=always
-Type=dbus
-BusName=xyz.openbmc_project.State.Host
-
-[Install]
-WantedBy=multi-user.target
diff --git a/service_files/xyz.openbmc_project.State.Host@.service b/service_files/xyz.openbmc_project.State.Host@.service
new file mode 100644
index 0000000..fded2f0
--- /dev/null
+++ b/service_files/xyz.openbmc_project.State.Host@.service
@@ -0,0 +1,20 @@
+[Unit]
+Description=Phosphor Host%i State Manager
+Wants=mapper-wait@-xyz-openbmc_project-control-host%i-auto_reboot.service
+After=mapper-wait@-xyz-openbmc_project-control-host%i-auto_reboot.service
+Wants=mapper-wait@-xyz-openbmc_project-state-chassis0.service
+After=mapper-wait@-xyz-openbmc_project-state-chassis0.service
+Wants=obmc-mapper.target
+After=obmc-mapper.target
+After=phosphor-ipmi-host.service
+After=pldmd.service
+Before=obmc-host-reset@%i.target
+
+[Service]
+ExecStart=/usr/bin/phosphor-host-state-manager --host %i
+Restart=always
+Type=dbus
+BusName=xyz.openbmc_project.State.Host%i
+
+[Install]
+WantedBy=multi-user.target