(POOLER-161) Fix extending vm lifetime when max lifetime is set

Before this PR, the current running time was being inspected to decide if the
vm lifetime could be extended. But since vm lifetime is absolute and not relative
this check is now removed.
This commit is contained in:
Samuel Beaulieu 2020-04-15 13:12:33 -05:00
parent 04a3c448fd
commit 953aa68907
2 changed files with 1 additions and 20 deletions

View file

@ -909,13 +909,6 @@ module Vmpooler
max_lifetime_upper_limit = max_lifetime_upper_limit.to_i
if arg.to_i >= max_lifetime_upper_limit
failure.push("You provided a lifetime (#{arg}) that exceeds the configured maximum of #{max_lifetime_upper_limit}.")
else
# also make sure we do not extend past max_lifetime_upper_limit
rdata = backend.hgetall('vmpooler__vm__' + params[:hostname])
running = ((Time.now - Time.parse(rdata['checkout'])) / 60 / 60).round(2)
unless running + arg.to_i < max_lifetime_upper_limit
failure.push("You provided a lifetime (#{arg}) that will extend the current lifetime past the configured maximum of #{max_lifetime_upper_limit}.")
end
end
end