-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'andrew/add-verbose-icos-flag' into 'master'
feat(ICSUP-3837): Add verbose flag to help debug NP support issues and add logrotation to host In cases where networking fails and we don't have logs, node provider support becomes very difficult. For HostOS networking issues, we can almost always debug the issue from a screenshot of the console of the error message. And for most GuestOS networking issues, the issue is almost always accompanied by a HostOS networking issue, so we can use that to aid debugging. Recently though, we've had a [NP support issue](https://matrix.to/#/!jUsknEqNdJobySpXuN:matrix.org/$G3zb444IxJW8rmAKGgkXjhqNBpxb7hYi15cNH60KgG8?via=matrix.org&via=greensteps.cn&via=rudd-o.com) where HostOS networking and logs were fine, but GuestOS networking failed and we couldn't see why without GuestOS logs. But because we do not give console access to node providers, we could not see the GuestOS logs. This motivated us to add a 'verbose' flag that pipes the GuestOS console to the Host terminal. We don't believe this to be a security risk because we are already giving 3rd party logging access to NPs soon, and access to the GuestOS console itself is still restricted. This MR also adds logrotation to the HostOS (note: logrotation was already on HostOS, but now it's being explicitly included in the base image and patched to run properly) See merge request dfinity-lab/public/ic!20045
- Loading branch information
Showing
18 changed files
with
113 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<cpu mode='host-passthrough' migratable='off'> | ||
<cache mode='passthrough'/> | ||
<topology sockets='2' cores='16' threads='2'/> | ||
<feature policy="require" name="topoext"/> | ||
</cpu> | ||
<cpu mode='host-passthrough' migratable='off'> | ||
<cache mode='passthrough'/> | ||
<topology sockets='2' cores='16' threads='2'/> | ||
<feature policy="require" name="topoext"/> | ||
</cpu> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<cpu mode='host-model' migratable='off'/> | ||
<cpu mode='host-model' migratable='off'/> |
8 changes: 8 additions & 0 deletions
8
ic-os/components/hostos-scripts/verbose-logging/logrotate.d/verbose-logging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/var/log/libvirt/qemu/guestos-serial.log { | ||
daily | ||
rotate 7 | ||
compress | ||
missingok | ||
notifempty | ||
copytruncate | ||
} |
11 changes: 11 additions & 0 deletions
11
ic-os/components/hostos-scripts/verbose-logging/verbose-logging.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Unit] | ||
Description=If verbose flag enabled, pipe GuestOS console to the Host terminal | ||
Requires=guestos.service | ||
After=guestos.service | ||
|
||
[Service] | ||
ExecStart=/opt/ic/bin/verbose-logging.sh | ||
Restart=always | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
27 changes: 27 additions & 0 deletions
27
ic-os/components/hostos-scripts/verbose-logging/verbose-logging.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
CONFIG="${CONFIG:=/boot/config/config.ini}" | ||
|
||
function read_variables() { | ||
# Read limited set of keys. Be extra-careful quoting values as it could | ||
# otherwise lead to executing arbitrary shell code! | ||
while IFS="=" read -r key value; do | ||
case "$key" in | ||
"verbose") verbose="${value}" ;; | ||
esac | ||
done <"${CONFIG}" | ||
} | ||
|
||
read_variables | ||
|
||
if [[ "${verbose,,}" == "true" ]]; then | ||
echo "##########################################" >/dev/tty1 | ||
echo "### STARTING GUESTOS CONSOLE LOGS... ###" >/dev/tty1 | ||
echo "##########################################" >/dev/tty1 | ||
|
||
# log slowly so as not to overwhelm the host terminal | ||
tail -f /var/log/libvirt/qemu/guestos-serial.log | while read -r line; do | ||
echo "$line" >/dev/tty1 | ||
sleep 0.075 | ||
done | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[Service] | ||
StateDirectory=logrotate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ sudo | |
udev | ||
usbutils | ||
zstd | ||
logrotate | ||
|
||
# SELinux support | ||
selinux-policy-default | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters