Skip to content

Commit

Permalink
Do not poll to check if QEMU is alive
Browse files Browse the repository at this point in the history
This allows to react quickly when QEMU finishes.

Signed-off-by: Akihiko Odaki <[email protected]>
  • Loading branch information
akihikodaki committed Jul 15, 2023
1 parent e0eea35 commit da7c84d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 3 additions & 5 deletions lib/engines/hckinstall/hckinstall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,8 @@ def run_studio_installer
@setup_studio_iso,
@studio_iso_info['path']
], keep_alive: false, snapshot: false)
Timeout.timeout(@studio_install_timeout) do
@logger.info('Waiting for studio installation finished')
sleep 5 while st.alive?
end
@logger.info('Waiting for studio installation finished')
raise AutoHCKError, 'studio installation timed out' if st.wait(@studio_install_timeout).nil?
end
end

Expand All @@ -239,7 +237,7 @@ def run_clients_installer
Timeout.timeout(@client_install_timeout) do
cl.each do |name, client|
@logger.info("Waiting for #{name} installation finished")
sleep 5 while client.alive?
client.wait
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/setupmanagers/physhck/physhck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(logger)
@logger = logger
end

def alive?
def wait(...)
@logger.info('Physical machine is always alive')
end

Expand Down
6 changes: 3 additions & 3 deletions lib/setupmanagers/qemuhck/qemu_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ def run_vm
end
end

def alive?
@qemu_thread.alive?
def wait(...)
@qemu_thread.join(...)
end

def soft_abort
Expand All @@ -133,7 +133,7 @@ def hard_abort
def vm_abort
@keep_alive = false

return unless alive?
return unless @qemu_thread.alive?

return if soft_abort

Expand Down

0 comments on commit da7c84d

Please sign in to comment.