Skip to content

Commit

Permalink
Make auto-converted code readable again
Browse files Browse the repository at this point in the history
  • Loading branch information
shundhammer committed Aug 23, 2018
1 parent c2682c0 commit b6363f7
Showing 1 changed file with 19 additions and 44 deletions.
63 changes: 19 additions & 44 deletions src/modules/StorageProposal.rb
Expand Up @@ -251,18 +251,10 @@ def GetControlCfg
Ops.set(@cfg_xml, "root_percent", 40)
end

stmp = ProductFeatures.GetStringFeature(
"partitioning",
"limit_try_home"
)
Ops.set(
@cfg_xml,
"home_limit",
Ops.divide(Storage.ClassicStringToByte(stmp), 1024 * 1024)
)
if Ops.less_or_equal(Ops.get_integer(@cfg_xml, "home_limit", 0), 0)
Ops.set(@cfg_xml, "home_limit", 5 * 1024)
end
home_limit = ProductFeatures.GetStringFeature("partitioning", "limit_try_home")
home_limit = Storage.ClassicStringToByte(home_limit) / (1024 * 1024)
home_limit = 5 * 1024 if home_limit <= 0
@cfg_xml["home_limit"] = home_limit

stmp = ProductFeatures.GetStringFeature(
"partitioning",
Expand Down Expand Up @@ -4005,17 +3997,15 @@ def get_proposal(have_swap, disk)
Builtins.add(Ops.get_list(conf, "partitions", []), root)
)
old_root = {}
if GetProposalHome() &&
Ops.less_than(Ops.get_integer(opts, "home_limit", 0), avail_size)
home = {
home_limit = opts["home_limit"] || 0
if GetProposalHome() && avail_size > home_limit
home =
{
"mount" => GetHomePath(),
"increasable" => true,
"fsys" => PropDefaultHomeFs(),
"size" => 512 * 1024 * 1024,
"pct" => Ops.subtract(
100,
Ops.get_integer(opts, "root_percent", 40)
)
"pct" => 100 - Ops.get_integer(opts, "root_percent", 40)
}
Ops.set(
conf,
Expand Down Expand Up @@ -4835,17 +4825,14 @@ def get_inst_proposal(target)
mode,
avail_size
)
if Ops.greater_than(avail_size, 0)
if avail_size > 0
if mode == :reuse
parts = Ops.get_list(disk, "partitions", [])
tmp = []
if GetProposalHome() &&
Ops.greater_than(
avail_size,
Ops.get_integer(opts, "home_limit", 0)
)
home_limit = opts["home_limit"] || 0
if GetProposalHome() && avail_size > home_limit
tmp = can_home_reuse(4 * 1024, 0, parts)
if Ops.greater_than(Builtins.size(tmp), 0)
if Builtins.size(tmp) > 0
have_home = true
parts = deep_copy(tmp)
end
Expand Down Expand Up @@ -4898,20 +4885,14 @@ def get_inst_proposal(target)
)
end
old_root = {}
if !have_home && GetProposalHome() &&
Ops.less_than(
Ops.get_integer(opts, "home_limit", 0),
avail_size
)
home_limit = opts["home_limit"] || 0
if !have_home && GetProposalHome() && avail_size > home_limit
home = {
"mount" => GetHomePath(),
"increasable" => true,
"fsys" => PropDefaultHomeFs(),
"size" => 512 * 1024 * 1024,
"pct" => Ops.subtract(
100,
Ops.get_integer(opts, "root_percent", 40)
)
"pct" => 100 - Ops.get_integer(opts, "root_percent", 40)
}
Ops.set(
conf,
Expand Down Expand Up @@ -5571,15 +5552,9 @@ def modify_vm(vm, opts, need_swap)
root_pe,
swap_pe
)
if home == nil && GetProposalHome() &&
Ops.greater_than(
free,
sizek_to_pe(
Ops.multiply(Ops.get_integer(opts, "home_limit", 0), 1024),
pe,
false
)
)
home_limit = opts["home_limit"] || 0
home_limit_pe = sizek_to_pe(home_limit * 1024, pe, false)
if home == nil && GetProposalHome() && free > home_limit_pe
tmp = Ops.divide(
Ops.multiply(free, Ops.get_integer(opts, "root_percent", 40)),
100
Expand Down

0 comments on commit b6363f7

Please sign in to comment.