-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added support for reporting kdump reboot cause to detect and report a kernel crash - Added additional commands to sonic-kdump-config wrapper script to dump Kdump configuration and status information in JSON format - Automatically save Kdump configuration in startup configuration file. This is an added convenience to the user as Kdump configuration changes require a system reboot and user is expected to save the configuration so that they are activated post reboot. - Additional bug fixes and improvements to allow hostcfgd to process Kdump configuration changes in ConfigDB. sonic-kdump-config script will write to ConfigDB. - Moved kdump CLI commands to a dedicated file Signed-off-by: Rajendra Dendukuri <rajendra.dendukuri@broadcom.com>
- Loading branch information
1 parent
9a17108
commit 042254e
Showing
6 changed files
with
320 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import os | ||
import click | ||
import utilities_common.cli as clicommon | ||
from swsssdk import ConfigDBConnector | ||
|
||
@click.group(cls=clicommon.AbbreviationGroup, name="kdump") | ||
def kdump(): | ||
""" Configure kdump """ | ||
if os.geteuid() != 0: | ||
exit("Root privileges are required for this operation") | ||
|
||
@kdump.command() | ||
def disable(): | ||
"""Disable kdump operation""" | ||
config_db = ConfigDBConnector() | ||
if config_db is not None: | ||
config_db.connect() | ||
config_db.mod_entry("KDUMP", "config", {"enabled": "false"}) | ||
|
||
@kdump.command() | ||
def enable(): | ||
"""Enable kdump operation""" | ||
config_db = ConfigDBConnector() | ||
if config_db is not None: | ||
config_db.connect() | ||
config_db.mod_entry("KDUMP", "config", {"enabled": "true"}) | ||
|
||
@kdump.command() | ||
@click.argument('kdump_memory', metavar='<kdump_memory>', required=True) | ||
def memory(kdump_memory): | ||
"""Set memory allocated for kdump capture kernel""" | ||
config_db = ConfigDBConnector() | ||
if config_db is not None: | ||
config_db.connect() | ||
config_db.mod_entry("KDUMP", "config", {"memory": kdump_memory}) | ||
|
||
@kdump.command('num-dumps') | ||
@click.argument('kdump_num_dumps', metavar='<kdump_num_dumps>', required=True, type=int) | ||
def num_dumps(kdump_num_dumps): | ||
"""Set max number of dump files for kdump""" | ||
config_db = ConfigDBConnector() | ||
if config_db is not None: | ||
config_db.connect() | ||
config_db.mod_entry("KDUMP", "config", {"num_dumps": kdump_num_dumps}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.