Skip to content

Commit 19e3c68

Browse files
authored
feat(node): Add log-config service to GuestOS (#3389)
Add the log-config service to GuestOS This service was previously just on HostOS and would log config.ini and deployment.json. Now the service is on HostOS and GuestOS and logs the config object.
1 parent c2b0c10 commit 19e3c68

File tree

7 files changed

+27
-11
lines changed

7 files changed

+27
-11
lines changed

ic-os/components/guestos.bzl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ component_files = {
6363
Label("misc/guestos/sysctl.d/privileged-ports.conf"): "/etc/sysctl.d/privileged-ports.conf",
6464
Label("misc/guestos/sysfs.d/hugepage.conf"): "/etc/sysfs.d/hugepage.conf",
6565
Label("misc/guestos/hsm/pcscd"): "/etc/default/pcscd",
66+
Label("misc/log-config/log-config-guestos.service"): "/etc/systemd/system/log-config.service",
67+
Label("misc/log-config/log-config.sh"): "/opt/ic/bin/log-config.sh",
6668

6769
# monitoring
6870
Label("monitoring/filebeat/setup-filebeat-permissions.sh"): "/opt/ic/bin/setup-filebeat-permissions.sh",
@@ -162,6 +164,6 @@ component_files = {
162164
# fstrim
163165
Label("fstrim/sync_fstrim.sh"): "/opt/ic/bin/sync_fstrim.sh",
164166

165-
# TODO(NODE-1519): delete update-config.service after switch to new icos config
167+
# TODO(NODE-1518): delete update-config.service after switch to new icos config
166168
Label("misc/update-config/update-guestos-config.service"): "/etc/systemd/system/update-config.service",
167169
}

ic-os/components/hostos.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ component_files = {
2929
Label("hostos-scripts/verbose-logging/verbose-logging.sh"): "/opt/ic/bin/verbose-logging.sh",
3030
Label("hostos-scripts/verbose-logging/verbose-logging.service"): "/etc/systemd/system/verbose-logging.service",
3131
Label("hostos-scripts/verbose-logging/logrotate.d/verbose-logging"): "/etc/logrotate.d/verbose-logging",
32-
Label("hostos-scripts/log-config/log-config.service"): "/etc/systemd/system/log-config.service",
33-
Label("hostos-scripts/log-config/log-config.sh"): "/opt/ic/bin/log-config.sh",
3432

3533
# early-boot
3634
Label("early-boot/relabel-machine-id/relabel-machine-id.sh"): "/opt/ic/bin/relabel-machine-id.sh",
@@ -73,6 +71,8 @@ component_files = {
7371
Label("monitoring/metrics-proxy/metrics-proxy.service"): "/etc/systemd/system/metrics-proxy.service",
7472
Label("monitoring/journald.conf"): "/etc/systemd/journald.conf",
7573
Label("monitoring/logrotate/override.conf"): "/etc/systemd/system/logrotate.service.d/override.conf",
74+
Label("misc/log-config/log-config-hostos.service"): "/etc/systemd/system/log-config.service",
75+
Label("misc/log-config/log-config.sh"): "/opt/ic/bin/log-config.sh",
7676

7777
# networking
7878
Label("networking/generate-network-config/hostos/generate-network-config.service"): "/etc/systemd/system/generate-network-config.service",
@@ -98,6 +98,6 @@ component_files = {
9898
Label("upgrade/systemd-generators/systemd-gpt-auto-generator"): "/etc/systemd/system-generators/systemd-gpt-auto-generator",
9999
Label("upgrade/install-upgrade.sh"): "/opt/ic/bin/install-upgrade.sh",
100100

101-
# TODO(NODE-1519): delete update-config.service after switch to new icos config
101+
# TODO(NODE-1518): delete update-config.service after switch to new icos config
102102
Label("misc/update-config/update-hostos-config.service"): "/etc/systemd/system/update-config.service",
103103
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[Unit]
2+
Description=Log config partition
3+
After=bootstrap-ic-node.service
4+
Requires=bootstrap-ic-node.service
5+
After=update-config.service
6+
Wants=update-config.service
7+
8+
[Service]
9+
Type=oneshot
10+
ExecStart=/opt/ic/bin/log-config.sh
11+
RemainAfterExit=true
12+
13+
[Install]
14+
WantedBy=multi-user.target

ic-os/components/hostos-scripts/log-config/log-config.service renamed to ic-os/components/misc/log-config/log-config-hostos.service

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
[Unit]
2-
Description=Log HostOS config partition
2+
Description=Log config partition
3+
After=update-config.service
4+
Wants=update-config.service
35

46
[Service]
57
Type=oneshot

ic-os/components/hostos-scripts/log-config/log-config.sh renamed to ic-os/components/misc/log-config/log-config.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/bin/bash
22

33
CONFIG_DIR="/boot/config"
4-
CONFIG="/boot/config/config.ini"
5-
DEPLOYMENT="/boot/config/deployment.json"
4+
CONFIG="/boot/config/config.json"
65

76
log_directory_structure() {
87
local dir=$1
@@ -28,7 +27,6 @@ log_file_contents() {
2827
fi
2928
}
3029

31-
echo "Logging HostOS config partition"
30+
echo "Logging config partition"
3231
log_directory_structure "$CONFIG_DIR"
3332
log_file_contents "$CONFIG"
34-
log_file_contents "$DEPLOYMENT"

ic-os/guestos/defs.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def image_deps(mode, malicious = False):
5555
# additional libraries to install
5656
"//rs/ic_os/release:nss_icos": "/usr/lib/x86_64-linux-gnu/libnss_icos.so.2:0644", # Allows referring to the guest IPv6 by name guestos from host, and host as hostos from guest.
5757

58-
# TODO(NODE-1519): delete config tool from guestos after switch to new icos config
58+
# TODO(NODE-1518): delete config tool from guestos after switch to new icos config
5959
"//rs/ic_os/release:config": "/opt/ic/bin/config:0755",
6060
},
6161

rs/ic_os/config/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ pub fn main() -> Result<()> {
367367

368368
generate_testnet_config(args, clap_args.guestos_config_json_path)
369369
}
370-
// TODO(NODE-1519): delete UpdateGuestosConfig and UpdateHostosConfig after moved to new config format
370+
// TODO(NODE-1518): delete UpdateGuestosConfig and UpdateHostosConfig after moved to new config format
371371
// Regenerate config.json on *every boot* in case the config structure changes between
372372
// when we roll out the update-config service and when we roll out the 'config integration'
373373
Some(Commands::UpdateGuestosConfig) => update_guestos_config(),

0 commit comments

Comments
 (0)