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:
parent
65b75a9212
commit
2e0f012952
@ -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…
Reference in New Issue
Block a user