bare-metal-setup: Add support for multiple hostlogger services
This commit updates the bare-metal-setup script to add a map from host
number to hostlogger script, in order to apply host-specific overrides
to each hostlogger service.
This commit introduces a default map for single-host machines, so we
don't need any new platform-specific configurations for those platforms.
But multi-host machines need a map showing which hostlogger service
corresponds to which host.
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
Platforms-Affected: All
Google-Bug-Id: 421463501
Change-Id: I8da484a06294b7fc6ecad6d5423ff4ab91d93e58
Signed-off-by: John Wedig <johnwedig@google.com>
(cherry picked from commit 9c724f24d19b70f605846d115f9836f65924ea61)
2 files changed