From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH] add acpi powerbutton support Date: Sat, 19 Jan 2008 16:40:06 +0100 Message-ID: <479219D6.1000707@web.de> References: <20080103181132.GA1077@bogon.ms20.nix> <20080103181415.GB1077@bogon.ms20.nix> <477D50FE.4040104@qumranet.com> <20080104183158.GA14002@bogon.ms20.nix> <47809A8F.5090803@qumranet.com> <20080107115916.GA24050@bogon.ms20.nix> <20080107120223.GB24050@bogon.ms20.nix> <47821EC8.4020308@qumranet.com> <20080108080928.GA9823@bogon.ms20.nix> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1643452441==" Cc: Jun Koi , public-kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f-z5DuStaUktnZ+VzJOa5vwg@public.gmane.org To: Guido Guenther Return-path: In-Reply-To: <20080108080928.GA9823-DVvpyRRQz99DDGxTMhc9XQ@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --===============1643452441== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigF94749EC97591040C861ADB8" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigF94749EC97591040C861ADB8 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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=20 >=20 > virsh shutdown >=20 > 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 =3D incoming; } =20 +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) } } =20 + 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); =20 Index: kvm-userspace/qemu/sysemu.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 --------------enigF94749EC97591040C861ADB8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFHkhnZniDOoMHTA+kRAlbHAJwJjng/eutVHjkAsTJVyP8FNq/VFQCdHb4U XjygIArJV3k3wzEH3Olr17Q= =/nn1 -----END PGP SIGNATURE----- --------------enigF94749EC97591040C861ADB8-- --===============1643452441== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- 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/ --===============1643452441== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kvm-devel mailing list kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/kvm-devel --===============1643452441==--