Reapply "bare-metal-setup: Add support for multiple hostlogger services"

This reverts commit be5aefbdd6719b2d2bdac2761cfead2e227efcab.

This commit reintroduces the support for multiple hostlogger services in
the bare-metal-setup script. It was reverted earlier due to some
flakiness detected in a Mimik test.

Tested:
Ran the hostlogger override functions in the script manually

Tested on a multi-host machine...

Before running override_hostlogger_in_bm_mode, saw these systemd links:
root@mvbcx10-nfd11:/etc/systemd/system/multi-user.target.wants# ls | grep hostlogger
hostlogger@ttyUSBP123A.service
hostlogger@ttyUSBP223A.service
hostlogger@ttyUSBP3A.service
hostlogger@ttyUSBP3C.service

After running override_hostlogger_in_bm_mode, 2 of the systemd links
under multi-user.target.wants were removed, and were replaced with links
under gbmc-bare-metal-active@<host_instance>.target.wants:
root@mvbcx10-nfd11:/etc/systemd/system/multi-user.target.wants# ls | grep hostlogger
hostlogger@ttyUSBP123A.service
hostlogger@ttyUSBP223A.service

root@mvbcx10-nfd11:/etc/systemd/system/gbmc-bare-metal-active@1.target.wants# ls -l
lrwxrwxrwx    1 root     root            43 Jun  2 11:37 hostlogger@ttyUSBP3A.service -> /usr/lib/systemd/system/hostlogger@.service

root@mvbcx10-nfd11:/etc/systemd/system/gbmc-bare-metal-active@2.target.wants# ls -l
lrwxrwxrwx    1 root     root            43 Jun  2 11:37 hostlogger@ttyUSBP3C.service -> /usr/lib/systemd/system/hostlogger@.service

After running recover_hostlogger_in_bm_mode, the original links were
restored, and the links under
gbmc-bare-metal-active@<host_instance>.target.wants were removed:
root@mvbcx10-nfd11:/etc/systemd/system/multi-user.target.wants# ls -l | grep hostlogger
lrwxrwxrwx    1 root     root            43 Mar  9  2018 hostlogger@ttyUSBP123A.service -> /usr/lib/systemd/system/hostlogger@.service
lrwxrwxrwx    1 root     root            43 Mar  9  2018 hostlogger@ttyUSBP223A.service -> /usr/lib/systemd/system/hostlogger@.service
lrwxrwxrwx    1 root     root            43 Jun  2 11:39 hostlogger@ttyUSBP3A.service -> /usr/lib/systemd/system/hostlogger@.service
lrwxrwxrwx    1 root     root            43 Jun  2 11:39 hostlogger@ttyUSBP3C.service -> /usr/lib/systemd/system/hostlogger@.service

Also tested on a single-host machine...

Before running override_hostlogger_in_bm_mode, saw this systemd links:
root@dddhe24-nfd01:/etc/systemd/system/multi-user.target.wants# ls -l | grep hostlogger
lrwxrwxrwx    1 root     root            43 Jun  2 16:17 hostlogger@ttyS1.service -> /usr/lib/systemd/system/hostlogger@.service

After running override_hostlogger_in_bm_mode, that systemd link
disappeared, and this new link was created:
root@dddhe24-nfd01:/etc/systemd/system/gbmc-bare-metal-active@0.target.wants# ls -l | grep hostlogger
lrwxrwxrwx    1 root     root            43 Jun  2 16:19 hostlogger@ttyS1.service -> /usr/lib/systemd/system/hostlogger@.service

After running recover_hostlogger_in_bm_mode, the original link was
restored, and the link under gbmc-bare-metal-active@0.target was
removed:
root@dddhe24-nfd01:/etc/systemd/system/multi-user.target.wants# ls -l | grep hostlogger
lrwxrwxrwx    1 root     root            43 Jun  2 16:20 hostlogger@ttyS1.service -> /usr/lib/systemd/system/hostlogger@.service

In addition, ran the bare metal test on a single-host and multi-host
machine:
https://fusion2.corp.google.com/ca727219-9664-4e3e-8847-4bddd94c1e2b
https://fusion2.corp.google.com/20db2c39-af63-4296-9c99-25f0edb1c83e

Google-Bug-Id: 421463501
Platforms-Affected: All
Change-Id: Icf0e9c842494394fa271f36226b350b53f7e8f47
Signed-off-by: John Wedig <johnwedig@google.com>
(cherry picked from commit f35dd05d9aad9783ff57eac7050a5c09d0a54472)
2 files changed
tree: c798bff5d154d6c37d19060149dfcac72e19870a
  1. classes/
  2. conf/
  3. dynamic-layers/
  4. recipes-bsp/
  5. recipes-connectivity/
  6. recipes-core/
  7. recipes-devtools/
  8. recipes-extended/
  9. recipes-google/
  10. recipes-kernel/
  11. recipes-phosphor/
  12. recipes-support/
  13. recipes-tpm1/
  14. recipes-tpm2/
  15. LICENSE
  16. README.md
README.md

meta-gbmc-staging

This repository contains additions to the openbmc/meta-google layer that are not yet ready for OpenBMC inclusion.

How to use this layer

  1. Clone openbmc/openbmc from GitHub.
  2. Clone this layer from GitHub into a subdirectory of openbmc.