Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kdump-remote feature in hostcfgd #166

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions scripts/hostcfgd
Original file line number Diff line number Diff line change
Expand Up @@ -1134,9 +1134,14 @@ class SshServer(object):
class KdumpCfg(object):
def __init__(self, CfgDb):
self.config_db = CfgDb
self.kdump_defaults = { "enabled" : "false",
"memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M",
"num_dumps": "3" }
self.kdump_defaults = {
"enabled": "false",
"memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M",
"num_dumps": "3",
"remote": "false", # New feature: remote, default is "false"
"SSH_KEY": "<user@server>", # New feature: SSH key, default value
"SSH_PATH": "<path>" # New feature: SSH path, default value
}

def load(self, kdump_table):
"""
Expand All @@ -1147,7 +1152,7 @@ class KdumpCfg(object):
for row in self.kdump_defaults:
value = self.kdump_defaults.get(row)
if not kdump_conf.get(row):
self.config_db.mod_entry("KDUMP", "config", {row : value})

Choose a reason for hiding this comment

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

Why do we need this change?

Copy link
Contributor

Choose a reason for hiding this comment

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

This change is still there, it is not removed. Added Detail for remote configs here in kdump table
image

self.config_db.mod_entry("KDUMP", "config", {row: value})

def kdump_update(self, key, data):
syslog.syslog(syslog.LOG_INFO, "Kdump global configuration update")
Expand Down Expand Up @@ -1177,6 +1182,19 @@ class KdumpCfg(object):
num_dumps = data.get("num_dumps")
run_cmd(["sonic-kdump-config", "--num_dumps", num_dumps])

# Remote option
remote = self.kdump_defaults["remote"]
if data.get("remote") is not None:
remote = data.get("remote")
run_cmd(["sonic-kdump-config", "--remote", remote])

# SSH key
if data.get("SSH_KEY") is not None and (data.get("SSH_KEY") != self.kdump_defaults["SSH_KEY"]):
run_cmd(["sonic-kdump-config", "--ssh_key", data.get("SSH_KEY")])
# SSH_PATH
if data.get("SSH_PATH") is not None and (data.get("SSH_PATH") != self.kdump_defaults["SSH_PATH"]):
run_cmd(["sonic-kdump-config", "--ssh_path", data.get("SSH_PATH")])

class NtpCfg(object):
"""
NtpCfg Config Daemon
Expand Down
Loading