Skip to content

Conversation

@mssonicbld
Copy link

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

…/proc/cmdline (installer.conf)

#### 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: sonic-net#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
```

3) save config and reboot the system
4) 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
- [x] 202405
@mssonicbld
Copy link
Author

Original PR: #237

@mssonicbld
Copy link
Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tjchadaga
Copy link

@arista-nwolfe, @mlok-nokia - could you help check the UT failures on this?

@arista-nwolfe
Copy link
Contributor

@arista-nwolfe, @mlok-nokia - could you help check the UT failures on this?

AssertionError: 'check_call' does not contain all of (call(['sonic-kdump-config', '--remote', 'false']), call(['sonic-kdump-config', '--ssh_string', 'user@localhost']), call(['sonic-kdump-config', '--ssh_path', '/a/b/c'])) in its call list, found [] instead

It looks like the PRs which added the arguments --remote --ssh_string and --ssh_path aren't in msft_202503
#166
#216
#209

You'll probably need to remove those expected calls from the test case

                call(['sonic-kdump-config', '--remote', 'false']),  # Covering remote
                call(['sonic-kdump-config', '--ssh_string', 'user@localhost']),  # Covering ssh_string
                call(['sonic-kdump-config', '--ssh_path', '/a/b/c'])  # Covering ssh_path

@mlok-nokia
Copy link
Contributor

@arista-nwolfe, @mlok-nokia - could you help check the UT failures on this?

AssertionError: 'check_call' does not contain all of (call(['sonic-kdump-config', '--remote', 'false']), call(['sonic-kdump-config', '--ssh_string', 'user@localhost']), call(['sonic-kdump-config', '--ssh_path', '/a/b/c'])) in its call list, found [] instead

It looks like the PRs which added the arguments --remote --ssh_string and --ssh_path aren't in msft_202503 #166 #216 #209

You'll probably need to remove those expected calls from the test case

                call(['sonic-kdump-config', '--remote', 'false']),  # Covering remote
                call(['sonic-kdump-config', '--ssh_string', 'user@localhost']),  # Covering ssh_string
                call(['sonic-kdump-config', '--ssh_path', '/a/b/c'])  # Covering ssh_path

Correct. These 3 default setting are not in 202503 branch.

            "remote": "false",            # New feature: remote, default is "false"
            "ssh_string": "user@localhost",   # New feature: SSH key, default value
            "ssh_path": "/a/b/c"          # New feature: SSH path, default value

@mssonicbld
Copy link
Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld mssonicbld merged commit a09889e into sonic-net:202411 Oct 27, 2025
5 checks passed
bingwang-ms added a commit to Azure/sonic-buildimage-msft that referenced this pull request Oct 28, 2025
<!--
Please make sure you've read and understood our contributing guidelines:
     https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md

** Make sure all your commits include a signature generated with `git
commit -s` **

If this is a bug fix, make sure your description includes "fixes #xxxx",
or
     "closes #xxxx" or "resolves #xxxx"

     Please provide the following information:
-->

#### Why I did it
To pick up hostcfgd fix to enable kdump on bootup

##### Work item tracking
- Microsoft ADO **(number only)**:

#### How I did it
Update submodule to include
sonic-net/sonic-host-services#315

#### How to verify it

<!--
If PR needs to be backported, then the PR must be tested against the
base branch and the earliest backport release branch and provide tested
image version on these two branches. For example, if the PR is requested
for master, 202211 and 202012, then the requester needs to provide test
results on master and 202012.
-->

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

<!--
- Note we only backport fixes to a release branch, *not* features!
- Please also provide a reason for the backporting below.
- e.g.
- [x] 202006
-->

- [ ] 201811
- [ ] 201911
- [ ] 202006
- [ ] 202012
- [ ] 202106
- [ ] 202111
- [ ] 202205
- [ ] 202211

#### Tested branch (Please provide the tested image version)

<!--
- Please provide tested image version
- e.g.
- [x] 20201231.100
-->

- [ ] <!-- image version 1 -->
- [ ] <!-- image version 2 -->

#### Description for the changelog
<!--
Write a short (one line) summary that describes the changes in this
pull request for inclusion in the changelog:
-->

<!--
Ensure to add label/tag for the feature raised. example - PR#2174 under
sonic-utilities repo. where, Generic Config and Update feature has been
labelled as GCU.
-->

#### Link to config_db schema for YANG module changes
<!--
Provide a link to config_db schema for the table for which YANG model
is defined
Link should point to correct section on
https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md
-->

#### A picture of a cute animal (not mandatory but encouraged)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants