Guido Guenther wrote: > On Tue, Jan 08, 2008 at 01:34:30PM +0900, Jun Koi wrote: >> Sorry for my ignorance, but .... what is the effect of this patch? So >> I can shutdown guest VM cleanly, or smt else?? > system_powerdown in the commmand monitor now simulates the pressing of > the acpi power button. This allows you to shutdown the system cleanly. > This is nice for things like libvirt where you can now do a > > virsh shutdown <vm> > > and the machine doesn't simply get killed. You need this patch for > libvirt:
What about additionally listening on signals? If you run qemu from the console, you can then just press ctrl-c to shut the guest down (instead of killing it that way). The same happens on host shutdown (if the guest is faster than the host's grace period before SIGKILL...). Jan --- qemu/sysemu.h | 2 +- qemu/vl.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) Index: kvm-userspace/qemu/vl.c =================================================================== --- kvm-userspace.orig/qemu/vl.c +++ kvm-userspace/qemu/vl.c @@ -8501,6 +8501,11 @@ void qemu_get_launch_info(int *argc, cha *opt_incoming = incoming; } +void qemu_powerdown_sighand(int signal) +{ + qemu_system_powerdown_request(); +} + int main(int argc, char **argv) { #ifdef CONFIG_GDBSTUB @@ -9475,6 +9480,9 @@ int main(int argc, char **argv) } } + signal(SIGINT, qemu_powerdown_sighand); + signal(SIGTERM, qemu_powerdown_sighand); + machine->init(ram_size, vga_ram_size, boot_devices, ds, kernel_filename, kernel_cmdline, initrd_filename, cpu_model); Index: kvm-userspace/qemu/sysemu.h =================================================================== --- kvm-userspace.orig/qemu/sysemu.h +++ kvm-userspace/qemu/sysemu.h @@ -35,7 +35,7 @@ int qemu_reset_requested(void); int qemu_powerdown_requested(void); #if !defined(TARGET_SPARC) && !defined(TARGET_I386) // Please implement a power failure function to signal the OS -#define qemu_system_powerdown() do{}while(0) +#define qemu_system_powerdown() exit(0) #else void qemu_system_powerdown(void); #endif
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel