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.
more_events
Roberto Hueso Gómez 2020-05-14 17:28:50 +02:00
parent 32b73c50b1
commit 3c055d198d
1 changed files with 2 additions and 2 deletions

View File

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