Skip to content

Commit

Permalink
Fix issue during upgrade of the system (bnc#946639)
Browse files Browse the repository at this point in the history
  • Loading branch information
ancorgs committed Sep 21, 2015
1 parent 66d7c96 commit 6930029
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/modules/Kdump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def WriteKdumpBootParameter
else
# Calculate the param values based on @allocated_memory
crash_values = crash_kernel_values
remove_offsets!(crash_value) if Mode.update
remove_offsets!(crash_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
end
Expand Down Expand Up @@ -1130,7 +1130,7 @@ def crash_kernel_values
def remove_offsets!(values)
# It could also be :missing or :present
if values.is_a?(Array)
crash_values.map! do |value|
values.map! do |value|
pieces = value.split("@")
if pieces.size > 1
Builtins.y2milestone("Delete offset crashkernel value: %1", value)
Expand Down
31 changes: 27 additions & 4 deletions test/kdump_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,14 @@
end

describe ".WriteKdumpBootParameter" do
before do
Yast::Mode.SetMode(mode)
end

context "during autoinstallation" do
let(:mode) { "autoinstallation" }

before do
Yast::Mode.SetMode("autoinstallation")
Yast::Kdump.Import(profile)
end

Expand Down Expand Up @@ -428,8 +433,9 @@
end

context "during autoupgrade" do
let(:mode) { "autoupgrade" }

before do
Yast::Mode.SetMode("autoupgrade")
Yast::Kdump.Import(profile)
end

Expand Down Expand Up @@ -490,11 +496,28 @@
end
end

context "during update" do
let(:mode) { "update" }

it "removes offsets from crashkernel" do
allow(Yast::Bootloader).to receive(:kernel_param).and_return "72M@128"

expect(Yast::Bootloader)
.to receive(:modify_kernel_params)
.with(:common, :xen_guest, :recovery, "crashkernel" => ["72M"])
expect(Yast::Bootloader).to receive(:Write)
expect(Yast::Service).to receive(:Enable).with("kdump")

Yast::Kdump.ReadKdumpKernelParam
Yast::Kdump.WriteKdumpBootParameter
end
end

context "in normal mode" do
let(:mode) { "normal" }

before do
Yast::Mode.SetMode("normal")
allow(Yast::Popup).to receive(:Message)

allow(Yast::Bootloader).to receive(:kernel_param).and_return kernel_param
Yast::Kdump.ReadKdumpKernelParam
end
Expand Down

0 comments on commit 6930029

Please sign in to comment.