mirror of
https://github.com/reactos/sysreg2.git
synced 2024-11-26 21:00:27 +00:00
[SYSREG2] Attempt a graceful ACPI shutdown before poweroff
This commit is contained in:
parent
1d2fe15ed9
commit
d2d0ef6677
16
libvirt.cpp
16
libvirt.cpp
@ -172,9 +172,21 @@ void LibVirt::ShutdownMachine()
|
||||
*/
|
||||
virDomainGetInfo(vDom, &info);
|
||||
|
||||
/* Kill the VM - if running */
|
||||
/* Shutdown the VM - if running */
|
||||
if (info.state != VIR_DOMAIN_SHUTOFF)
|
||||
virDomainDestroy(vDom);
|
||||
{
|
||||
/* We will first try a graceful shutdown */
|
||||
virDomainReboot(vDom, VIR_DOMAIN_REBOOT_ACPI_POWER_BTN);
|
||||
|
||||
sleep(3);
|
||||
|
||||
/* Is the VM shut? */
|
||||
virDomainGetInfo(vDom, &info);
|
||||
|
||||
/* Kill the VM - if running */
|
||||
if (info.state != VIR_DOMAIN_SHUTOFF)
|
||||
virDomainDestroy(vDom);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < 12; ++i)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user