1
0
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:
Tino Vázquez 2023-01-05 13:56:38 +01:00
parent c55d969d5f
commit c5c248cbca
No known key found for this signature in database
GPG Key ID: 14201E424D02047E
3 changed files with 21 additions and 21 deletions

View File

@ -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

View File

@ -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)}

View File

@ -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}" \