Skip to content

[kdump-config] Update kdump default config with pre-defined value in /proc/cmdline (installer.conf) #237

Merged
judyjoseph merged 2 commits intosonic-net:masterfrom
mlok-nokia:kdump_enable_by_proc_cmdline
May 2, 2025
Merged

[kdump-config] Update kdump default config with pre-defined value in /proc/cmdline (installer.conf) #237
judyjoseph merged 2 commits intosonic-net:masterfrom
mlok-nokia:kdump_enable_by_proc_cmdline

Conversation

@mlok-nokia
Copy link
Contributor

@mlok-nokia mlok-nokia commented Apr 10, 2025

Why I did it

Modify the hostcfgd to handle the kdump enabled to the CONFIG_DB when kdump is enabled by default in the platform installer.conf . Related PR for 202405 is: #236

How I did it

Added a new method init_kdump_config_from_cmdline() in the KdumpCfg class to check the /proc/cmdline. If key "crashkernel=" exists in /proc/cmdline when system is up, this means that the kdump is enabled. init_kdump_config_from_cmdline() will update the kdump_defaults and CONFIG_DB when if the current config data are not matched the pre-defined data in the /proc/cmdline. This happens during a new image upgrade with the crashkernel is defined the platform installer.conf.

How to verify it

  1. install an image with predefine kdump enabled in the grub.conf.
  2. execute the "config load_minigraph"
    • check it should not any error in the syslog
    • After the hostcfgd is running, execute "show kdump config" should show kdump is enabled. Output as below
admin@sonic:~$ show kdump config
Kdump administrative mode: Enabled
Kdump operational mode: Ready
Kdump memory reservation: 8G-:1G
Maximum number of Kdump files: 3
  1. save config and reboot the system
  2. show command should show the kdump is enabled and also there should not be any kdump/hostcfgd error log in syslog

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305
  • 202405

@mssonicbld
Copy link

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mlok-nokia
Copy link
Contributor Author

@judyjoseph and @arlakshm Here is master PR which handle kdump enabled in the platform installer.conf. Please review it.

@mssonicbld
Copy link

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

…efined in a platform installer.conf

Signed-off-by: mlok <[email protected]>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the kdump configuration handling to automatically update the defaults if kdump is enabled via the platform's installer configuration found in /proc/cmdline. Key changes include:

  • Adding a new method in KdumpCfg to read and parse /proc/cmdline for the "crashkernel=" parameter.
  • Implementing a conditional update of the configuration database when discrepancies are detected.
  • Introducing a new test case in hostcfgd_test.py to validate the new behavior.

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
tests/hostcfgd/hostcfgd_test.py Added a unit test to simulate /proc/cmdline based kdump config
scripts/hostcfgd Introduces init_kdump_config_from_cmdline and adjusts update logic based on /proc/cmdline
Files not reviewed (1)
  • tests/proc/cmdline: Language not supported

@mssonicbld
Copy link

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mlok-nokia
Copy link
Contributor Author

@judyjoseph and @arlakshm Please merge help to merge this PR

Copy link
Contributor

@judyjoseph judyjoseph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@judyjoseph
Copy link
Contributor

@mlok-nokia an additional test would be to see the result when "crash-kernel" is present in /proc/cmdline and user configures via kdump CLI. Make sure it overwrites what is set in /proc/cmdline

@judyjoseph judyjoseph merged commit 00393e3 into sonic-net:master May 2, 2025
5 checks passed
@tjchadaga
Copy link

@kperumalbfn - could you please help cherry-pick this to 202411?

@r12f
Copy link

r12f commented Nov 9, 2025

included in 202411. removing 202412 tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

8 participants