Skip to content

Commit

Permalink
Merge pull request #136 from yast/backport_sp6
Browse files Browse the repository at this point in the history
Backport sp6
  • Loading branch information
jreidinger committed Sep 15, 2023
2 parents 498e4e7 + 4c4d011 commit 37dabe3
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 124 deletions.
17 changes: 15 additions & 2 deletions package/yast2-kdump.changes
@@ -1,7 +1,20 @@
-------------------------------------------------------------------
Fri Sep 01 19:57:03 UTC 2023 - Josef Reidinger <jreidinger@suse.com>
Fri Jun 23 12:00:54 CEST 2023 - Jiri Bohac <jbohac@suse.cz>

- Branch package for SP6 (bsc#1208913)
- adapt for version kdump versions 1.9+ (bsc#1212646)
- call mkdumprd directly, not through tu-rebuild-kdump-initrd
- update initrd even in non-fadump case
- remove KDUMP_COPY_KERNEL and KDUMPTOOL_FLAGS options from UI
- deprecate KDUMP_COPY_KERNEL and KDUMPTOOL_FLAGS options in AY
- update default config values according to kdump defaults
- unify config boolean variables to "true" or "false"
- support the snappy, zstd and raw dump formats
- 4.6.1

-------------------------------------------------------------------
Fri Mar 03 14:44:07 UTC 2023 - Ladislav Slezák <lslezak@suse.cz>

- Bump version to 4.6.0 (bsc#1208913)

-------------------------------------------------------------------
Fri Dec 9 09:53:31 UTC 2022 - Josef Reidinger <jreidinger@suse.com>
Expand Down
2 changes: 1 addition & 1 deletion package/yast2-kdump.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-kdump
Version: 4.6.0
Version: 4.6.1
Release: 0
Summary: Configuration of kdump
License: GPL-2.0-only
Expand Down
4 changes: 3 additions & 1 deletion src/autoyast-rnc/kdump.rnc
Expand Up @@ -41,10 +41,12 @@ kdump_general = element general {
element KDUMP_REQUIRED_PROGRAMS { STRING }? &
element KDUMP_PRESCRIPT { STRING }? &
element KDUMP_POSTSCRIPT { STRING }? &
# deprecated and ignored option. Will be dropped
element KDUMPTOOL_FLAGS { STRING }? &
element KDUMP_NETCONFIG { STRING }? &
element KDUMP_NET_TIMEOUT { STRING }? &
# deprecated and ignored option. Will be dropped
element KDUMP_COPY_KERNEL { STRING }? &
element KDUMP_NET_TIMEOUT { STRING }? &
element KEXEC_OPTIONS { STRING }? &
element KDUMP_RUNLEVEL { STRING }? &
element KDUMP_IMMEDIATE_REBOOT { STRING }? &
Expand Down
25 changes: 6 additions & 19 deletions src/include/kdump/dialogs.rb
Expand Up @@ -171,7 +171,10 @@ def wid_handling
["none_format", _("&No Dump")],
["elf_format", _("&ELF Format")],
["compressed_format", _("C&ompressed Format")],
["lzo_format", _("&LZO Compressed Format")]
["lzo_format", _("&LZO Compressed Format")],
["snappy_format", _("&Snappy Compressed Format")],
["zstd_format", _("Zstandard Compressed Format")],
["raw_format", _("Raw copy of /proc/vmcore")]
],
"orientation" => :horizontal,
"init" => fun_ref(
Expand Down Expand Up @@ -347,20 +350,6 @@ def wid_handling
),
"help" => HelpKdump("EnableReboot")
},
"EnableCopyKernel" => {
# TRANSLATORS: CheckBox Label
"label" => _(
"Enable Copy Ke&rnel into the Dump Directory"
),
"widget" => :checkbox,
"init" => fun_ref(method(:InitEnableCopyKernel), "void (string)"),
# "handle" :
"store" => fun_ref(
method(:StoreEnableCopyKernel),
"void (string, map)"
),
"help" => HelpKdump("EnableCopyKernel")
},
"EnableDeleteImages" => {
# TRANSLATORS: CheckBox Label
"label" => _(
Expand Down Expand Up @@ -498,8 +487,7 @@ def tabs
VBox(
Left("EnableDeleteImages"),
Left("NumberDumps"),
Left("EnableReboot"),
Left("EnableCopyKernel")
Left("EnableReboot")
)
)
),
Expand All @@ -515,8 +503,7 @@ def tabs
"NumberDumps",
"InitrdKernel",
"SelectKernel",
"EnableReboot",
"EnableCopyKernel"
"EnableReboot"
]
}
}
Expand Down
13 changes: 4 additions & 9 deletions src/include/kdump/helps.rb
Expand Up @@ -74,7 +74,10 @@ def initialize_kdump_helps(_include_target)
" <i>No Dump</i> - Only save the kernel log.<br>\n" \
" <i>ELF Format</i> - Create dump file in ELF format.<br>\n" \
" <i>Compressed Format</i> - Compress dump data by each page with gzip.<br>\n" \
" <i>LZO Compressed Format</i> - Slightly bigger files but much faster.<br>\n</p>"
" <i>LZO Compressed Format</i> - Slightly bigger files but much faster.<br>\n</p>" \
" <i>Snappy Compressed Format</i> - Considerably faster, 64-bit optimized.<br>\n</p>" \
" <i>Zstandard Compressed Format</i> - Smaller files, slower.<br>\n</p>" \
" <i>Raw copy of /proc/vmcore</i> - does not use makedumpfile.<br>\n</p>"
),
# Dump Format - RadioButtons 1/7
"TargetKdump" => _(
Expand Down Expand Up @@ -161,14 +164,6 @@ def initialize_kdump_helps(_include_target)
" Enable Delete Old Dump Images. If the number of dump files in \n" \
" <i>Number of Old Dumps</i> exceeds this number, older dumps are removed.<br></p>"
),
# Enable Copy Ke&rnel into the Dump Directory - CheckBox 1/1
"EnableCopyKernel" => _(
"<p><b>Enable Copy Kernel into the Dump Directory</b> - \n" \
" If this option is selected, the kernel and the\n" \
" debugging information (if installed) are copied into the dump\n" \
" directory. The default is \"off\". It is useful to have\n" \
" everything in place for debugging.<br></p>\n"
),
# SMTP Server
"SMTPServer" => _(
"<p><b>SMTP Server</b> used for sending a notification email after a dump.</p>"
Expand Down
56 changes: 21 additions & 35 deletions src/include/kdump/uifunctions.rb
Expand Up @@ -1125,7 +1125,7 @@ def InitEnableReboot(_key)
UI.ChangeWidget(
Id("EnableReboot"),
:Value,
Ops.get(Kdump.KDUMP_SETTINGS, "KDUMP_IMMEDIATE_REBOOT") == "yes" ? true : false
["yes", "true", "1"].include?(Ops.get(Kdump.KDUMP_SETTINGS, "KDUMP_IMMEDIATE_REBOOT"))
)

nil
Expand All @@ -1138,7 +1138,7 @@ def StoreEnableReboot(_key, _event)
Ops.set(
Kdump.KDUMP_SETTINGS,
"KDUMP_IMMEDIATE_REBOOT",
Convert.to_boolean(UI.QueryWidget(Id("EnableReboot"), :Value)) ? "yes" : "no"
Convert.to_boolean(UI.QueryWidget(Id("EnableReboot"), :Value)) ? "true" : "false"
)

nil
Expand Down Expand Up @@ -1349,7 +1349,7 @@ def InitKdumpMemory(_key)
UI.ChangeWidget(Id(:auto_resize), :Enabled, false)
auto_resize = false
else
auto_resize = Kdump.KDUMP_SETTINGS["KDUMP_AUTO_RESIZE"] == "yes"
auto_resize = ["yes", "true", "1"].include?(Kdump.KDUMP_SETTINGS["KDUMP_AUTO_RESIZE"])
end
UI.ChangeWidget(Id(:auto_resize), :Value, auto_resize)
if Kdump.total_memory > 0
Expand Down Expand Up @@ -1420,7 +1420,7 @@ def ValidKdumpMemory(_key, _event)
# "KdumpMemory"
def StoreKdumpMemory(_key, _event)
Kdump.KDUMP_SETTINGS["KDUMP_AUTO_RESIZE"] =
UI.QueryWidget(Id(:auto_resize), :Value) ? "yes" : "no"
UI.QueryWidget(Id(:auto_resize), :Value) ? "true" : "false"
Kdump.allocated_memory[:low] = Builtins.tostring(
UI.QueryWidget(Id("allocated_low_memory"), :Value)
)
Expand Down Expand Up @@ -1509,12 +1509,19 @@ def StoreInitrdKernel(_key, _event)
# "Dump Format"

def InitDumpFormat(_key)
if Ops.get(Kdump.KDUMP_SETTINGS, "KDUMP_DUMPFORMAT") == "ELF"
case Ops.get(Kdump.KDUMP_SETTINGS, "KDUMP_DUMPFORMAT")
when "ELF"
UI.ChangeWidget(Id("DumpFormat"), :Value, "elf_format")
elsif Ops.get(Kdump.KDUMP_SETTINGS, "KDUMP_DUMPFORMAT") == "compressed"
when "compressed"
UI.ChangeWidget(Id("DumpFormat"), :Value, "compressed_format")
elsif Ops.get(Kdump.KDUMP_SETTINGS, "KDUMP_DUMPFORMAT") == "lzo"
when "lzo"
UI.ChangeWidget(Id("DumpFormat"), :Value, "lzo_format")
when "snappy"
UI.ChangeWidget(Id("DumpFormat"), :Value, "snappy_format")
when "zstd"
UI.ChangeWidget(Id("DumpFormat"), :Value, "zstd_format")
when "raw"
UI.ChangeWidget(Id("DumpFormat"), :Value, "raw_format")
else
UI.ChangeWidget(Id("DumpFormat"), :Value, "none_format")
end
Expand All @@ -1530,7 +1537,7 @@ def ValidDumpFormat(_key, _event)
result = true
value = Builtins.tostring(UI.QueryWidget(Id("DumpFormat"), :Value))

if value != "elf_format" || value.nil?
if value != "raw_format" || value.nil?
if Mode.installation || Mode.autoinst
Kdump.kdump_packages = Builtins.add(
Kdump.kdump_packages,
Expand Down Expand Up @@ -1578,6 +1585,12 @@ def StoreDumpFormat(_key, _event)
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_DUMPFORMAT", "compressed")
elsif value == "lzo_format"
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_DUMPFORMAT", "lzo")
elsif value == "snappy_format"
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_DUMPFORMAT", "snappy")
elsif value == "zstd_format"
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_DUMPFORMAT", "zstd")
elsif value == "raw_format"
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_DUMPFORMAT", "raw")
else
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_DUMPFORMAT", "none")
end
Expand Down Expand Up @@ -1640,33 +1653,6 @@ def StoreEnableDeleteImages(_key, _event)
nil
end

# Function initializes option
# "Enable Copy Kernel into the Dump Directory"

def InitEnableCopyKernel(_key)
if Ops.get(Kdump.KDUMP_SETTINGS, "KDUMP_COPY_KERNEL", "no") == "yes"
UI.ChangeWidget(Id("EnableCopyKernel"), :Value, true)
else
UI.ChangeWidget(Id("EnableCopyKernel"), :Value, false)
end

nil
end

# Function stores option
# "Enable Copy Kernel into the Dump Directory"

def StoreEnableCopyKernel(_key, _event)
value = Convert.to_boolean(UI.QueryWidget(Id("EnableCopyKernel"), :Value))
if !value
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_COPY_KERNEL", "no")
else
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_COPY_KERNEL", "yes")
end

nil
end

# Function initializes option
# "SMTP Server"
def InitSMTPServer(_key)
Expand Down
38 changes: 7 additions & 31 deletions src/lib/kdump/clients/kdump.rb
Expand Up @@ -80,7 +80,7 @@ def main
"handler" => fun_ref(method(:cmdKdumpDumpFormat), "boolean (map)"),
# TRANSLATORS: CommandLine help
"help" => _(
"Dump format for dump image: none/ELF/compressed/lzo"
"Dump format for dump image: none/ELF/compressed/lzo/snappy/zstd/raw"
),
"example" => [
"dumpformat dump_format=none",
Expand Down Expand Up @@ -145,14 +145,6 @@ def main
),
"example" => ["immediatereboot enable", "immediatereboot disable"]
},
"copykernel" => {
"handler" => fun_ref(method(:cmdKdumpCopyKernel), "boolean (map)"),
# TRANSLATORS: CommandLine help
"help" => _(
"Copy kernel into dump directory."
),
"example" => ["copykernel enable", "copykernel disable"]
},
"keepolddumps" => {
"handler" => fun_ref(method(:cmdKdumpKeepOldDumps), "boolean (map)"),
# TRANSLATORS: CommandLine help
Expand Down Expand Up @@ -239,7 +231,7 @@ def main
"type" => "string",
# TRANSLATORS: CommandLine help
"help" => _(
"Dump format can be none, ELF, compressed or lzo"
"Dump format can be none, ELF, compressed, lzo, snappy, zstd, or raw"
)
},
"target" => {
Expand Down Expand Up @@ -639,7 +631,7 @@ def cmdKdumpShow(_options)
CommandLine.Print(
Builtins.sformat(
_("Kdump immediate reboots: %1"),
if Ops.get(Kdump.KDUMP_SETTINGS, "KDUMP_IMMEDIATE_REBOOT") == "yes"
if ["yes", "true", "1"].include?(Ops.get(Kdump.KDUMP_SETTINGS, "KDUMP_IMMEDIATE_REBOOT"))
_("Enabled")
else
_("Disabled")
Expand Down Expand Up @@ -794,8 +786,7 @@ def cmdKdumpDumpLevel(options)
def cmdKdumpDumpFormat(options)
options = deep_copy(options)
if Ops.get(options, "dump_format")
if Ops.get(options, "dump_format") == "ELF" ||
Ops.get(options, "dump_format") == "compressed"
if ["none", "ELF", "compressed", "lzo", "snappy", "zstd", "raw"].include?(Ops.get(options, "dump_format"))
Ops.set(
Kdump.KDUMP_SETTINGS,
"KDUMP_DUMPFORMAT",
Expand All @@ -809,7 +800,7 @@ def cmdKdumpDumpFormat(options)
CommandLine.Error(_("Wrong value of option."))
# TRANSLATORS: CommandLine printed text help
CommandLine.Print(
_("Option can include only \"none\", \"ELF\", \"compressed\" or \"lzo\" value.")
_("Option can include only \"none\", \"ELF\", \"compressed\", \"lzo\", \"snappy\", \"zstd\" or \"raw\" value.")
)
return false
end
Expand Down Expand Up @@ -1101,25 +1092,10 @@ def cmdKdumpKernelCommandLineAppend(options)
def cmdKdumpImmediateReboot(options)
options = deep_copy(options)
if Ops.get(options, "enable")
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_IMMEDIATE_REBOOT", "yes")
return true
elsif Ops.get(options, "disable")
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_IMMEDIATE_REBOOT", "no")
return true
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong options were used."))
return false
end
end

def cmdKdumpCopyKernel(options)
options = deep_copy(options)
if Ops.get(options, "enable")
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_COPY_KERNEL", "yes")
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_IMMEDIATE_REBOOT", "true")
return true
elsif Ops.get(options, "disable")
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_COPY_KERNEL", "no")
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_IMMEDIATE_REBOOT", "false")
return true
else
# TRANSLATORS: CommandLine error message
Expand Down

0 comments on commit 37dabe3

Please sign in to comment.