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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]