-
Notifications
You must be signed in to change notification settings - Fork 12
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 for xen #75
Kdump for xen #75
Changes from 3 commits
022b645
07430a5
e5ce166
98fae85
c02ec5e
b82133b
4976edb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,6 +106,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" | ||
# | ||
|
@@ -270,6 +274,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 | ||
|
@@ -295,6 +300,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 | ||
|
||
|
@@ -453,14 +466,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 | ||
|
@@ -469,16 +486,21 @@ 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 | ||
|
@@ -487,6 +509,7 @@ def WriteKdumpBootParameter | |
if @crashkernel_param | ||
#delete crashkernel parameter from bootloader | ||
Bootloader.modify_kernel_params(:common, :xen_guest, :recovery, "crashkernel" => :missing) | ||
Bootloader.modify_kernel_params(:common, :xen_host, :recovery, "crashkernel" => :missing) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo here, only There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just note it is harmless, as it is done one line up, so I merge it. |
||
if !Stage.initial | ||
old_progress = Progress.set(false) | ||
Bootloader.Write | ||
|
@@ -920,8 +943,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_kernel_values | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
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) | ||
} | ||
|
@@ -955,6 +981,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 | ||
|
@@ -1123,6 +1157,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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to mimic the above line because Export uses either an array or a single string too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, thanks for notice.