Revert "daemon: fix kernel argument management and logging errors"#147
Conversation
|
Thanks for your PR,
To skip the vendors CIs, Maintainers can use one of:
|
This reverts commit d19331c. Signed-off-by: Fred Rolland <frolland@nvidia.com>
Greptile OverviewGreptile SummaryThis PR reverts a prior change that adjusted Ubuntu GRUB kernel-argument handling and a logging statement in the daemon. Key impact areas:
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant D as sriov-config-daemon
participant P as mainPlugin (VendorPlugin)
participant H as Host (/host)
participant G as GRUB config (/etc/default/grub)
D->>P: OnNodeStateChange(desiredNodeState)
alt plugin returns error
D-->>D: log error (mainPluginName)
else plugin returns requirements
D-->>D: aggregate drain/reboot requirement
end
opt Ubuntu kernel args update
D->>H: chroot /host read /etc/os-release
D->>G: copy to /tmp/grub
D->>G: edit /tmp/grub (sed/grep)
D->>G: copy /tmp/grub back to /etc/default/grub
D->>H: chroot /host update-grub
end
|
| reqDrain, reqReboot, err := dn.mainPlugin.OnNodeStateChange(desiredNodeState) | ||
| if err != nil { | ||
| funcLog.Error(err, "OnNodeStateChange plugin error", "mainPluginName", dn.mainPlugin.Name()) | ||
| funcLog.Error(err, "OnNodeStateChange plugin error", "mainPluginName", dn.mainPlugin.Name) | ||
| return false, false, err |
There was a problem hiding this comment.
[P0] dn.mainPlugin.Name is a method, not a field
plugin.VendorPlugin is used elsewhere as an interface with a Name() method (see line 304). Logging dn.mainPlugin.Name will print a function value (or fail compilation depending on the concrete type), and it’s inconsistent with the other log entries.
| reqDrain, reqReboot, err := dn.mainPlugin.OnNodeStateChange(desiredNodeState) | |
| if err != nil { | |
| funcLog.Error(err, "OnNodeStateChange plugin error", "mainPluginName", dn.mainPlugin.Name()) | |
| funcLog.Error(err, "OnNodeStateChange plugin error", "mainPluginName", dn.mainPlugin.Name) | |
| return false, false, err | |
| funcLog.Error(err, "OnNodeStateChange plugin error", "mainPluginName", dn.mainPlugin.Name()) |
| if ${IS_OS_UBUNTU} ; then | ||
| grub_config="/etc/default/grub" | ||
| # Operate on the copy of the file | ||
| # Use host's /tmp because container root might be read-only | ||
| tmp_grub_path=$(chroot "$chroot_path" mktemp) | ||
| tmp_grub_in_container="${chroot_path}${tmp_grub_path}" | ||
| cp ${chroot_path}/${grub_config} "${tmp_grub_in_container}" | ||
| cp ${chroot_path}/${grub_config} /tmp/grub |
There was a problem hiding this comment.
[P1] /tmp/grub is a fixed path and isn’t cleaned up
On Ubuntu this script copies ${chroot_path}/${grub_config} to a host-level /tmp/grub and later writes it back, but it never deletes it and it’s not unique per invocation. This can cause cross-run interference (concurrent daemons/nodes/containers writing the same file) and can leave stale content behind if the script exits early.
This reverts commit d19331c.