1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-20 15:28:22 +00:00

Improve ACPI shutdown for virtualbox

This commit is contained in:
Julien Duponchelle 2017-02-24 13:58:03 +01:00
parent 65b75a9212
commit 2e0f012952
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -303,6 +303,16 @@ class VirtualBoxVM(BaseNode):
if self.acpi_shutdown: if self.acpi_shutdown:
# use ACPI to shutdown the VM # use ACPI to shutdown the VM
result = yield from self._control_vm("acpipowerbutton") 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" self.status = "stopped"
log.debug("ACPI shutdown result: {}".format(result)) log.debug("ACPI shutdown result: {}".format(result))
else: else: