mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-20 10:50:08 +03:00
L #-: YodaStyle new cop compliance
(cherry picked from commit abeccc507f83b3ad39cca3f3d5acf6edc0fdc5a6)
This commit is contained in:
parent
c55d969d5f
commit
c5c248cbca
@ -709,7 +709,7 @@ CommandParser::CmdParser.new(ARGV) do
|
||||
|
||||
tokens = helper.find_token(user, token_hint, group, false)
|
||||
|
||||
if tokens.length.zero?
|
||||
if tokens.empty?
|
||||
exit_with_code 1, 'No valid tokens found.'
|
||||
end
|
||||
|
||||
|
@ -87,8 +87,8 @@ vmpool.each do |vm|
|
||||
base_net = Time.now.to_i % 10000
|
||||
|
||||
mon_s = unindent(<<-EOS)
|
||||
NETTX=#{base_net + (50 * rand(3))}
|
||||
NETRX=#{base_net + (100 * rand(4))}
|
||||
NETTX=#{base_net + (rand(3) * 50)}
|
||||
NETRX=#{base_net + (rand(4) * 100)}
|
||||
MEMORY=#{max_memory * rand(20..100)/100}
|
||||
CPU=#{max_cpu * rand(5..100)/100}
|
||||
DISKRDBYTES=#{rand(1000)}
|
||||
|
@ -1034,26 +1034,26 @@ module OneProvision
|
||||
['ansible_processor_count']
|
||||
|
||||
# Compute reserved CPU shares for host
|
||||
res_cpu = 100 * case host_cpu
|
||||
when 1..4
|
||||
0 # looks like testing environment
|
||||
when 5..10 then 1 # reserve 1 core
|
||||
when 11..20 then 2 # 2 cores
|
||||
else 3 # 3 cores
|
||||
end
|
||||
res_cpu = case host_cpu
|
||||
when 1..4
|
||||
0 # looks like testing environment
|
||||
when 5..10 then 1 # reserve 1 core
|
||||
when 11..20 then 2 # 2 cores
|
||||
else 3 # 3 cores
|
||||
end * 100
|
||||
|
||||
# Compute reserved MEMORY for host (in KB)
|
||||
res_mem = 1024 * case host_mem
|
||||
when 0..4000
|
||||
0 # looks like testing environment
|
||||
when 4001..6001 then 1000 # reserv
|
||||
when 6001..10000 then 2000 # 2GB
|
||||
when 10001..20000 then 4000 # 4GB
|
||||
when 20001..40000 then 5000 # 5GB
|
||||
when 40001..64000 then 8000 # 8GB
|
||||
when 64001..128000 then 12000 # 12GB
|
||||
else 16000 # 16GB
|
||||
end
|
||||
res_mem = case host_mem
|
||||
when 0..4000
|
||||
0 # looks like testing environment
|
||||
when 4001..6001 then 1000 # reserv
|
||||
when 6001..10000 then 2000 # 2GB
|
||||
when 10001..20000 then 4000 # 4GB
|
||||
when 20001..40000 then 5000 # 5GB
|
||||
when 40001..64000 then 8000 # 8GB
|
||||
when 64001..128000 then 12000 # 12GB
|
||||
else 16000 # 16GB
|
||||
end * 1024
|
||||
rescue StandardError
|
||||
raise OneProvisionLoopException, \
|
||||
"Missing facts for #{hostname}" \
|
||||
|
Loading…
x
Reference in New Issue
Block a user