From 3c055d198d64aabdf2b1fd2a5da3e308577e6082 Mon Sep 17 00:00:00 2001 From: Roberto Hueso Gómez Date: Thu, 14 May 2020 17:28:50 +0200 Subject: Wait before polling QMP for host poweroff This patch waits before polling qemu with QMP so that it has time to be ready for requests. It also increases wait time in case the host machine is slow. --- src/ogRest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ogRest.py b/src/ogRest.py index 3f76053..64558a2 100644 --- a/src/ogRest.py +++ b/src/ogRest.py @@ -98,15 +98,15 @@ class ogThread(): ogRest.state = ThreadState.IDLE def check_vm_state_loop(ogRest): - POLLING_WAIT_TIME = 3 + POLLING_WAIT_TIME = 12 while True: + time.sleep(POLLING_WAIT_TIME) state = ogRest.operations.check_vm_state() installed_os = ogRest.operations.get_installed_os() if state == OgVM.State.STOPPED and \ ogRest.state == ThreadState.IDLE and \ len(installed_os) > 0: ogRest.operations.poweroff_host() - time.sleep(POLLING_WAIT_TIME) def poweroff(ogRest): time.sleep(2) -- cgit v1.2.3-18-g5258