Skip to content

Commit

Permalink
spelling fix: alocated -> allocated
Browse files Browse the repository at this point in the history
The only published symbol was Kdump.alocated_memory.
I've checked that it is not used outside this RPM.
  • Loading branch information
mvidner committed Jan 22, 2014
1 parent 42ffea9 commit 845d5fc
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 41 deletions.
4 changes: 2 additions & 2 deletions src/clients/kdump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def cmdKdumpShow(options)
CommandLine.Print(
Builtins.sformat(
_("Allocate memory (MB) for kdump is: %1"),
Kdump.alocated_memory
Kdump.allocated_memory
)
)
else
Expand Down Expand Up @@ -737,7 +737,7 @@ def cmdKdumpStartup(options)
if Ops.get(options, "enable") != nil &&
Ops.get(options, "alloc_mem") != nil
Kdump.add_crashkernel_param = true
Kdump.alocated_memory = Builtins.tostring(Ops.get(options, "alloc_mem"))
Kdump.allocated_memory = Builtins.tostring(Ops.get(options, "alloc_mem"))
#TRANSLATORS: CommandLine printed text
if Kdump.crashkernel_list_ranges
CommandLine.Print(
Expand Down
4 changes: 2 additions & 2 deletions src/include/kdump/uifunctions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,7 @@ def InitKdumpMemory(key)
UI.ChangeWidget(
Id("memory_buffer"),
:Value,
Builtins.tointeger(Kdump.alocated_memory)
Builtins.tointeger(Kdump.allocated_memory)
)
UI.ChangeWidget(
Id("usable_memory"),
Expand Down Expand Up @@ -1454,7 +1454,7 @@ def ValidKdumpMemory(key, event)

def StoreKdumpMemory(key, event)
event = deep_copy(event)
Kdump.alocated_memory = Builtins.tostring(
Kdump.allocated_memory = Builtins.tostring(
UI.QueryWidget(Id("memory_buffer"), :Value)
)

Expand Down
54 changes: 27 additions & 27 deletions src/modules/Kdump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def main
# "crashkernel"
#
# string value number of alocate memory
@alocated_memory = "0"
@allocated_memory = "0"

# Boolean option indicates that Import()
# was called and data was proposed
Expand Down Expand Up @@ -465,12 +465,12 @@ def checkPassword
end


# get alocated memory from value of crashkernel option
# get allocated memory from value of crashkernel option
# there can be several ranges -> take the first range
# @param string 64M@16M or 128M-:64M@16M [(reserved_memory*2)-:reserved_memory]
# @return [String] value of alocated memory (64M)
# @return [String] value of allocated memory (64M)

def getAlocatedMemory(crash_value)
def getAllocatedMemory(crash_value)
result = ""
allocated = ""
range = ""
Expand All @@ -496,7 +496,7 @@ def getAlocatedMemory(crash_value)
result
end

# Build crashkernel value from alocated memory
# Build crashkernel value from allocated memory
#
# @return [String] value of crashkernel

Expand All @@ -506,7 +506,7 @@ def BuildCrashkernelValue
return @crashkernel_param_value if @crashkernel_list_ranges

crash_value = ""
crash_value = Ops.add(@alocated_memory, "M")
crash_value = Ops.add(@allocated_memory, "M")

# bnc#563905 problem with offset in crashkernel
if Arch.i386 || Arch.x86_64 || Arch.ia64 || Arch.ppc64
Expand All @@ -523,7 +523,7 @@ def BuildCrashkernelValue
end

reserved_memory = Builtins.tostring(
Ops.multiply(2, Builtins.tointeger(@alocated_memory))
Ops.multiply(2, Builtins.tointeger(@allocated_memory))
)


Expand All @@ -542,7 +542,7 @@ def BuildCrashkernelValue
def convertCrashkernelForXEN(crash)
crash_value = ""
if crash != ""
crash_value = Ops.add(getAlocatedMemory(crash), "M")
crash_value = Ops.add(getAllocatedMemory(crash), "M")
# bnc#563905 problem with offset in crashkernel
#if ((Arch::i386()) ||(Arch::x86_64()) || Arch::ppc64())
# crash_value = crash_value + "@16M";
Expand Down Expand Up @@ -621,7 +621,7 @@ def ReadXenKdumpKernelParam(act_boot_secion)
@crashkernel_param = true
@add_crashkernel_param = true
@crashkernel_param_value = getCrashKernelValue(crash_arg)
@alocated_memory = getAlocatedMemory(@crashkernel_param_value)
@allocated_memory = getAllocatedMemory(@crashkernel_param_value)
else
@crashkernel_param = false
@add_crashkernel_param = false
Expand Down Expand Up @@ -662,7 +662,7 @@ def ReadKdumpKernelParam

@crashkernel_param_value = result
if result != "false"
@alocated_memory = getAlocatedMemory(@crashkernel_param_value)
@allocated_memory = getAllocatedMemory(@crashkernel_param_value)
end

true
Expand All @@ -673,50 +673,50 @@ def ReadKdumpKernelParam
#
# @return [Boolean] successfull

def ProposeAlocatedMemory
if @alocated_memory == "0"
def ProposeAllocatedMemory
if @allocated_memory == "0"
if Ops.greater_or_equal(@total_memory, 512) &&
Ops.less_than(Ops.divide(@total_memory, 1024), 2)
@alocated_memory = "64"
@allocated_memory = "64"
elsif Ops.greater_or_equal(Ops.divide(@total_memory, 1024), 2)
@alocated_memory = "128"
@allocated_memory = "128"
end

# bnc #431492 - UPT-LTE: /proc/vmcore is empty in kdump kerne
if Arch.ppc64 && @alocated_memory != ""
al_mem = Builtins.tointeger(@alocated_memory)
if Arch.ppc64 && @allocated_memory != ""
al_mem = Builtins.tointeger(@allocated_memory)
al_mem = Ops.multiply(al_mem, 2)
@alocated_memory = Builtins.tostring(al_mem)
@allocated_memory = Builtins.tostring(al_mem)
end
# bnc #446480 - Fine-tune kdump memory proposal
if Arch.ia64 && Ops.greater_or_equal(@total_memory, 1024)
total_memory_gigabyte = Ops.divide(@total_memory, 1024)
if Ops.greater_or_equal(total_memory_gigabyte, 1) &&
Ops.less_than(total_memory_gigabyte, 8)
@alocated_memory = "256"
@allocated_memory = "256"
elsif Ops.greater_or_equal(total_memory_gigabyte, 8) &&
Ops.less_than(total_memory_gigabyte, 128)
@alocated_memory = "512"
@allocated_memory = "512"
elsif Ops.greater_or_equal(total_memory_gigabyte, 128) &&
Ops.less_than(total_memory_gigabyte, 256)
@alocated_memory = "768"
@allocated_memory = "768"
elsif Ops.greater_or_equal(total_memory_gigabyte, 256) &&
Ops.less_than(total_memory_gigabyte, 378)
@alocated_memory = "1024"
@allocated_memory = "1024"
elsif Ops.greater_or_equal(total_memory_gigabyte, 378) &&
Ops.less_than(total_memory_gigabyte, 512)
@alocated_memory = "1536"
@allocated_memory = "1536"
elsif Ops.greater_or_equal(total_memory_gigabyte, 512) &&
Ops.less_than(total_memory_gigabyte, 768)
@alocated_memory = "2048"
@allocated_memory = "2048"
elsif Ops.greater_or_equal(total_memory_gigabyte, 768)
@alocated_memory = "3072"
@allocated_memory = "3072"
end
end
end
Builtins.y2milestone(
"[kdump] allocated memory if not set in \"crashkernel\" param: %1",
@alocated_memory
@allocated_memory
)
true
end
Expand Down Expand Up @@ -756,7 +756,7 @@ def ReadAvailableMemory
"[kdump] (ReadAvailableMemory) total phys. memory [MB]: %1",
Builtins.tostring(@total_memory)
)
ProposeAlocatedMemory()
ProposeAllocatedMemory()
true
end

Expand Down Expand Up @@ -1356,7 +1356,7 @@ def using_fadump_changed?
publish :variable => :crashkernel_param, :type => "boolean"
publish :variable => :crashkernel_param_value, :type => "string"
publish :variable => :add_crashkernel_param, :type => "boolean"
publish :variable => :alocated_memory, :type => "string"
publish :variable => :allocated_memory, :type => "string"
publish :variable => :import_called, :type => "boolean"
publish :variable => :actual_boot_section, :type => "string"
publish :variable => :write_only, :type => "boolean"
Expand Down
19 changes: 9 additions & 10 deletions test/kdump_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,22 @@
Yast.import "Kdump"

describe Kdump do
# NOTE Kdump misspells "allocate" as "alocate"
# alocated_memory is a string in megabytes
# total_memory is an integer in megabytes
describe "#ProposeAlocatedMemory" do
# allocated_memory is a string in megabytes
# total_memory is an integer in megabytes
describe "#ProposeAllocatedMemory" do
context "when already proposed" do
before(:each) do
Kdump.alocated_memory = "42"
Kdump.allocated_memory = "42"
end
it "returns the current value" do
Kdump.ProposeAlocatedMemory
expect(Kdump.alocated_memory).to eq "42"
Kdump.ProposeAllocatedMemory
expect(Kdump.allocated_memory).to eq "42"
end
end

context "when not yet proposed" do
before(:each) do
Kdump.alocated_memory = "0"
Kdump.allocated_memory = "0"
end

PHYSICAL_TO_PROPOSED_MB = {
Expand Down Expand Up @@ -63,8 +62,8 @@
pair.each do |physical_mb, proposed_mb|
it "proposes #{proposed_mb}MB for #{physical_mb}MB physical memory" do
Kdump.total_memory = physical_mb
Kdump.ProposeAlocatedMemory
expect(Kdump.alocated_memory).to eq proposed_mb.to_s
Kdump.ProposeAllocatedMemory
expect(Kdump.allocated_memory).to eq proposed_mb.to_s
end
end
end
Expand Down

0 comments on commit 845d5fc

Please sign in to comment.