Skip to content

Commit

Permalink
Merge branch 'SLE-12-SP2' into merge_xen_hypervisor_casp
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Mar 30, 2017
2 parents c395c14 + 3524729 commit 9c8822b
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 12 deletions.
10 changes: 8 additions & 2 deletions package/yast2-kdump.changes
@@ -1,14 +1,20 @@
-------------------------------------------------------------------
Wed Mar 29 14:25:05 UTC 2017 - jreidinger@suse.com

- fix dumping kernel with Xen hypervisor (bsc#1014136)
- 3.1.44.1

-------------------------------------------------------------------
Tue Feb 14 12:08:46 UTC 2017 - mvidner@suse.com

- Explicitly create the kdump initrd (bsc#1022496).
- 3.1.44
- 3.1.44.0

-------------------------------------------------------------------
Wed Jan 25 13:01:58 UTC 2017 - mvidner@suse.com

- Implement simple_mode -> label_proposal (FATE#322328)
- 3.1.43
- 3.1.43.1

-------------------------------------------------------------------
Thu Sep 22 15:20:08 CEST 2016 - schubi@suse.de
Expand Down
2 changes: 1 addition & 1 deletion package/yast2-kdump.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-kdump
Version: 3.1.44
Version: 3.1.44.1
Release: 0
Summary: Configuration of kdump
License: GPL-2.0
Expand Down
7 changes: 7 additions & 0 deletions src/autoyast-rnc/kdump.rnc
Expand Up @@ -6,15 +6,22 @@ namespace config = "http://www.suse.com/1.0/configns"
kdump =
element kdump {
(kdump_crash_kernel_value | kdump_crash_kernel_list)? &
# parameter specify crashkernel value for xen hypervisor
(kdump_crash_xen_kernel_value | kdump_crash_xen_kernel_list)? &
kdump_add_crash_kernel? &
kdump_general?
}

kdump_crash_kernel_value = element crash_kernel { text }
kdump_crash_xen_kernel_value = element crash_xen_kernel { text }
kdump_crash_kernel_list = element crash_kernel {
LIST,
kdump_crash_kernel_entry+
}
kdump_crash_xen_kernel_list = element crash_xen_kernel {
LIST,
kdump_crash_kernel_entry+
}
kdump_crash_kernel_entry = element listentry { text }
kdump_add_crash_kernel = element add_crash_kernel { BOOLEAN }

Expand Down
62 changes: 60 additions & 2 deletions src/modules/Kdump.rb
Expand Up @@ -107,6 +107,10 @@ def reset
# array values of kernel parameter
@crashkernel_param_values = []

# array values of kernel parameter for Xen hypervisor
# see @crashkernel_param_values for details
@crashkernel_xen_param_values = []

# Boolean option indicates add kernel param
# "crashkernel"
#
Expand Down Expand Up @@ -271,6 +275,7 @@ def checkPassword
def ReadKdumpKernelParam
result = Bootloader.kernel_param(:common, "crashkernel")
result = Bootloader.kernel_param(:xen_guest, "crashkernel") if result == :missing
xen_result = Bootloader.kernel_param(:xen_host, "crashkernel")
# result could be [String,Array,:missing,:present]
# String - the value of the only occurrence
# Array - the values of the multiple occurrences
Expand All @@ -296,6 +301,14 @@ def ReadKdumpKernelParam
@allocated_memory = get_allocated_memory(@crashkernel_param_values)
end

if xen_result == :missing || xen_result == :present
@crashkernel_xen_param_values = xen_result
else
# Let's make sure it's an array
# filtering nils and empty entries bnc#991140
@crashkernel_xen_param_values = Array(xen_result).compact.reject(&:empty?)
end

true
end

Expand Down Expand Up @@ -464,14 +477,18 @@ def WriteKdumpBootParameter
if Mode.autoinst || Mode.autoupgrade
# Use the value(s) read by import
crash_values = @crashkernel_param_values
crash_xen_values = @crashkernel_xen_param_values
# Always write the value
skip_crash_values = false
else
# Calculate the param values based on @allocated_memory
crash_values = crash_kernel_values
crash_xen_values = crash_xen_kernel_values
remove_offsets!(crash_values) if Mode.update
remove_offsets!(crash_xen_values) if Mode.update
# Skip writing of param if it's already set to the desired values
skip_crash_values = @crashkernel_param && @crashkernel_param_values == crash_values
skip_crash_values &&= @crashkernel_xen_param_values && @crashkernel_xen_param_values == crash_xen_values
end

if skip_crash_values
Expand All @@ -480,24 +497,29 @@ def WriteKdumpBootParameter
Service.Restart(KDUMP_SERVICE_NAME) if Service.active?(KDUMP_SERVICE_NAME)
else
Bootloader.modify_kernel_params(:common, :xen_guest, :recovery, "crashkernel" => crash_values)
Bootloader.modify_kernel_params(:xen_host, "crashkernel" => crash_xen_values)
# do mass write in installation to speed up, so skip this one
if !Stage.initial
old_progress = Progress.set(false)
Bootloader.Write
Progress.set(old_progress)
end
Builtins.y2milestone(
"[kdump] (WriteKdumpBootParameter) adding chrashkernel options with values: %1",
"[kdump] (WriteKdumpBootParameter) adding crashkernel options with values: %1",
crash_values
)
Builtins.y2milestone(
"[kdump] (WriteKdumpBootParameter) adding xen crashkernel options with values: %1",
crash_xen_values
)
reboot_needed = true
Service.Enable(KDUMP_SERVICE_NAME)
end
else
# If we don't need the param but it is there
if @crashkernel_param
#delete crashkernel parameter from bootloader
Bootloader.modify_kernel_params(:common, :xen_guest, :recovery, "crashkernel" => :missing)
Bootloader.modify_kernel_params(:common, :xen_guest, :recovery, :xen_host, "crashkernel" => :missing)
if !Stage.initial
old_progress = Progress.set(false)
Bootloader.Write
Expand Down Expand Up @@ -931,8 +953,11 @@ def filterExport(settings)
def Export
crash_kernel = crash_kernel_values
crash_kernel = crash_kernel[0] if crash_kernel.size == 1
crash_xen_kernel = crash_xen_kernel_values
crash_xen_kernel = crash_xen_kernel[0] if crash_xen_kernel.size == 1
out = {
"crash_kernel" => crash_kernel,
"crash_xen_kernel" => crash_xen_kernel,
"add_crash_kernel" => @add_crashkernel_param,
"general" => filterExport(@KDUMP_SETTINGS)
}
Expand Down Expand Up @@ -966,6 +991,14 @@ def Import(settings)
# Make sure it's an array
@crashkernel_param_values = Array(crash_kernel_values)
end

if Builtins.haskey(settings, "crash_xen_kernel")
# Make sure it's an array
@crashkernel_xen_param_values = Array(settings.fetch("crash_xen_kernel", ""))
else
@crashkernel_xen_param_values = Array(crash_xen_kernel_values)
end

if settings.has_key?("add_crash_kernel")
@add_crashkernel_param = settings["add_crash_kernel"]
else
Expand Down Expand Up @@ -1134,6 +1167,31 @@ def crash_kernel_values
result
end

def crash_xen_kernel_values
# If the current values include "nasty" things and the user has not
# overriden the value of @crashkernel_list_ranges to autorize the
# modification.
# The old value (ensuring the Array format) will be returned.
if @crashkernel_list_ranges
return Array(@crashkernel_xen_param_values.dup)
end

result = []
high = @allocated_memory[:high]
low = @allocated_memory[:low]
sum = 0
sum += low.to_i if low
sum += high.to_i if high

if sum != 0
result << "#{sum}M\\<4G"
end

log.info "built xen crashkernel values are #{result}"

result
end

# Removes offsets from all the crashkernel values
#
# Beware: not functional, it modifies the passed argument
Expand Down

0 comments on commit 9c8822b

Please sign in to comment.