mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-12 09:17:41 +03:00
F #4926: Improve microVM deploy driver checks.
Includes fix to clean script (cherry picked from commit edc7d7d17ef519fb132a6cf25291f7b9ef0af6b0) co-authored-by: Christian González <cgonzalez@opennebula.io>
This commit is contained in:
parent
52b314a73f
commit
5d8ec9f7be
@ -42,11 +42,19 @@ microvm.gen_logs_files
|
||||
|
||||
# Create microVM
|
||||
rc = microvm.create
|
||||
sleep(1)
|
||||
|
||||
if !rc
|
||||
STDERR.puts 'There was an error deploying the microVM. Check oned.log.'
|
||||
microvm.clean(false)
|
||||
|
||||
exit(-1)
|
||||
end
|
||||
|
||||
# Make sure process have started
|
||||
if !rc || microvm.get_pid == -1
|
||||
STDERR.puts 'MicroVM failed to start.'
|
||||
rc = microvm.wait_deploy
|
||||
|
||||
if !rc
|
||||
STDERR.puts 'MicroVM process did not start.'
|
||||
microvm.clean(false)
|
||||
|
||||
exit(-1)
|
||||
|
@ -130,6 +130,15 @@ class MicroVM
|
||||
get_pid < 0
|
||||
end
|
||||
|
||||
def wait_deploy
|
||||
t_start = Time.now
|
||||
timeout = 5
|
||||
|
||||
next while (Time.now - t_start < timeout) && (get_pid < 0)
|
||||
|
||||
get_pid > 0
|
||||
end
|
||||
|
||||
# rubocop:disable Lint/RedundantCopDisableDirective
|
||||
# rubocop:disable Lint/SuppressedException
|
||||
def wait_cgroup(path)
|
||||
|
@ -21,6 +21,9 @@
|
||||
# running) or the timeout is reached.
|
||||
function retry
|
||||
{
|
||||
# Disable exit on error
|
||||
set +e
|
||||
|
||||
times=$1
|
||||
function=$2
|
||||
|
||||
@ -36,6 +39,8 @@ function retry
|
||||
error=$?
|
||||
done
|
||||
|
||||
# enable exit on error back
|
||||
set -e
|
||||
[ "x$error" = "x0" ]
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user