Skip to content

Commit 7ff7451

Browse files
EtiennePerotgvisor-bot
authored andcommitted
Add more debug logging for host settings.
This ensures that: - If not checked, a message about that is still printed. - If checked but already optimal, a message about that is also printed. Put together, this ensures that host settings behavior always has non-zero output in the logs, so that what it is doing is always explicit rather than having to infer what is happening from the lack of logs. PiperOrigin-RevId: 744029122
1 parent b1b7c02 commit 7ff7451

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

runsc/hostsettings/hostsettings.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ import (
2727
"gvisor.dev/gvisor/runsc/config"
2828
)
2929

30-
// Handle deals with host settings according to the given policy.
30+
// Handle deals with host settings according to the given config.
3131
func Handle(conf *config.Config) error {
3232
switch conf.HostSettings {
3333
case config.HostSettingsIgnore:
34+
log.Infof("Host settings not checked per config.")
3435
return nil
3536
case config.HostSettingsCheck, config.HostSettingsCheckMandatory:
3637
deltas, errs := check(conf)
@@ -151,6 +152,7 @@ func (s pathSetting) Delta(conf *config.Config) (*Delta, error) {
151152
return nil, fmt.Errorf("cannot read %q: %w", s.path, err)
152153
}
153154
currentValue := strings.TrimSpace(string(currentBytes))
155+
log.Debugf("Host settings: Current value of %q: %q", s.path, currentValue)
154156
newValue, mandatory, err := s.delta(conf, currentValue)
155157
if err != nil {
156158
return nil, err
@@ -320,6 +322,8 @@ func check(conf *config.Config) ([]*Delta, []error) {
320322
}
321323
if delta != nil {
322324
deltas = append(deltas, delta)
325+
} else {
326+
log.Infof("Host setting %q is optimal", setting.Name())
323327
}
324328
}
325329
return deltas, errs

0 commit comments

Comments
 (0)