[Libvir] [patch] qemu/kvm: use_system_powerdown instead of killing the vm hard

Richard W.M. Jones rjones at redhat.com
Mon Jan 14 12:29:16 UTC 2008


Guido Guenther wrote:
> On Wed, Jan 09, 2008 at 03:56:52PM +0000, Daniel P. Berrange wrote:
>> Well there's a 'system_reset'  monitor command, but its unclear if
>> its actually working - when i run it, it stops the guest from responding
>> to any keyboard input and makes it take 100% CPU, but doesn't reboot :-(
>> If that's not suitable i think the ctrl-alt-delete thing is probably the
>> best we can do.
> system_reset *resets* the machine (like hitting the reset switch). It
> doesn't shutdown anything, probaly not what we want. Here's a patch that
> does the ctrl-alt-del (on top of the previous domainsShutdown patch).
> This looks much more friendly to the filesystem. There are issues in kvm
> where after the reboot the ACPI tables are borked, but that's another
> issue.
> 
> Index: libvirt-0.4.0/src/qemu_driver.c
> ===================================================================
> --- libvirt-0.4.0.orig/src/qemu_driver.c	2008-01-09 16:23:34.000000000 +0000
> +++ libvirt-0.4.0/src/qemu_driver.c	2008-01-09 16:24:27.000000000 +0000
> @@ -1866,7 +1866,26 @@
>          return -1;
>      }
>      return 0;
> +}
> +
> +
> +static int qemudDomainReboot(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, "sendkey ctrl-alt-delete", &info) < 0) {
> +        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
> +                         "reboot operation failed");
> +        return -1;
> +    }
> +    return 0;
>  }
>  
>  
> @@ -2877,7 +2896,7 @@
>      qemudDomainSuspend, /* domainSuspend */
>      qemudDomainResume, /* domainResume */
>      qemudDomainShutdown, /* domainShutdown */
> -    NULL, /* domainReboot */
> +    qemudDomainReboot, /* domainReboot */
>      qemudDomainDestroy, /* domainDestroy */
>      qemudDomainGetOSType, /* domainGetOSType */
>      NULL, /* domainGetMaxMemory */

NACK - doesn't do the right thing at all on Windows.

Rich.

-- 
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20080114/cc31df0c/attachment-0001.bin>


More information about the libvir-list mailing list