Skip to content

Commit

Permalink
tuned: controller: narrow down reapplySysctl
Browse files Browse the repository at this point in the history
Simplify the code with no intended changes in behavior.

Signed-off-by: Francesco Romani <[email protected]>
  • Loading branch information
ffromani committed Jul 23, 2024
1 parent b7b6c39 commit 905a6eb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/tuned/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1062,16 +1062,14 @@ func (c *Controller) changeSyncerTuneD(change Change) (synced bool, err error) {
}

// Does the current TuneD process have the reapply_sysctl option turned on?
reapplySysctl := c.tunedMainCfg.Section("").Key("reapply_sysctl").MustBool()
if reapplySysctl != change.reapplySysctl {
if reapplySysctl := c.tunedMainCfg.Section("").Key("reapply_sysctl").MustBool(); reapplySysctl != change.reapplySysctl {
klog.V(4).Infof("reapplySysctl rewriting configuration file")

if err = iniCfgSetKey(c.tunedMainCfg, "reapply_sysctl", !reapplySysctl); err != nil {
return false, err
}
err = iniFileSave(tunedMainConfPath, c.tunedMainCfg)
if err != nil {
return false, fmt.Errorf("failed to write global TuneD configuration file: %v", err)
return false, fmt.Errorf("failed to write global TuneD configuration file: %w", err)
}
klog.V(4).Infof("reapplySysctl triggering tuned restart")
restart = true // A complete restart of the TuneD daemon is needed due to configuration change in tuned-main.conf file.
Expand Down

0 comments on commit 905a6eb

Please sign in to comment.