Improve ACPI shutdown for virtualbox

pull/916/head
Julien Duponchelle 7 years ago
parent 65b75a9212
commit 2e0f012952
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

@ -303,6 +303,16 @@ class VirtualBoxVM(BaseNode):
if self.acpi_shutdown:
# use ACPI to shutdown the VM
result = yield from self._control_vm("acpipowerbutton")
trial = 0
while True:
vm_state = yield from self._get_vm_state()
if vm_state == "poweroff":
break
yield from asyncio.sleep(1)
trial += 1
if trial >= 120:
yield from self._control_vm("poweroff")
break
self.status = "stopped"
log.debug("ACPI shutdown result: {}".format(result))
else:

Loading…
Cancel
Save