diff --git a/AUTHORS b/AUTHORS index c102fc4b91..51198269c7 100644 --- a/AUTHORS +++ b/AUTHORS @@ -38,6 +38,7 @@ Patches have also been contributed by: Shuveb Hussain Jim Paris Chris Lalancette + Guido Guenther [....send patches to get your name here....] diff --git a/ChangeLog b/ChangeLog index 104ce2e50f..627b0a96dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Jan 9 10:55:00 EST 2008 Daniel P. Berrange + + * src/qemu_driver.c: Wire up to system_shutdown command for + graceful ACPI triggered shutdown process (Guido Guenther) + Tue Jan 8 12:48:00 EST 2008 Daniel P. Berrange * src/util.c: cast off_t to int in debug output to avoid warning diff --git a/src/qemu_driver.c b/src/qemu_driver.c index f792eba1a0..55adb1844b 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -1849,6 +1849,27 @@ static int qemudDomainResume(virDomainPtr dom) { } +static int qemudDomainShutdown(virDomainPtr dom) { + struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData; + struct qemud_vm *vm = qemudFindVMByID(driver, dom->id); + char* info; + + if (!vm) { + qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, + "no domain with matching id %d", dom->id); + return -1; + } + + if (qemudMonitorCommand(driver, vm, "system_powerdown", &info) < 0) { + qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, + "shutdown operation failed"); + return -1; + } + return 0; + +} + + static int qemudDomainDestroy(virDomainPtr dom) { struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData; struct qemud_vm *vm = qemudFindVMByID(driver, dom->id); @@ -2855,7 +2876,7 @@ static virDriver qemuDriver = { qemudDomainLookupByName, /* domainLookupByName */ qemudDomainSuspend, /* domainSuspend */ qemudDomainResume, /* domainResume */ - qemudDomainDestroy, /* domainShutdown */ + qemudDomainShutdown, /* domainShutdown */ NULL, /* domainReboot */ qemudDomainDestroy, /* domainDestroy */ qemudDomainGetOSType, /* domainGetOSType */