From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GhHe0-0006Jz-Mj for qemu-devel@nongnu.org; Mon, 06 Nov 2006 22:29:00 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GhHdz-0006GY-5t for qemu-devel@nongnu.org; Mon, 06 Nov 2006 22:28:59 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GhHdy-0006G7-Vs for qemu-devel@nongnu.org; Mon, 06 Nov 2006 22:28:59 -0500 Received: from [38.99.2.47] (helo=luke.xen.prgmr.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GhHdy-0006yr-OM for qemu-devel@nongnu.org; Mon, 06 Nov 2006 22:28:59 -0500 Received: from luke.xen.prgmr.com (localhost [IPv6:::1]) by luke.xen.prgmr.com (8.13.3/8.13.3) with ESMTP id kA73Rus6021267 for ; Mon, 6 Nov 2006 19:27:56 -0800 (PST) Received: from localhost (lsc@localhost) by luke.xen.prgmr.com (8.13.3/8.13.3) with ESMTP id kA73Rpc2001359 for ; Mon, 6 Nov 2006 19:27:56 -0800 (PST) Date: Mon, 6 Nov 2006 19:27:51 -0800 (PST) From: Luke Crawford Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: [Qemu-devel] trivial patch for -exit-upon-reboot Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org As part of a client's plan to use systemimager to image Xen domUs, it has become convenient to make qemu exit after the OS inside calls reboot (so the Xen master can move on to installing the second xen guest) I first used a patch by Brad Campbell: http://www.mail-archive.com/qemu-devel@nongnu.org/msg06327.html this worked great for by-hand installs, (the problem before was that systemimager would infinitely loop, and you had to kill it within a fairly short period of time to get a clean system) but now the SysAdmins are automating things, and having qemu exit when the install is done has become important. I made some quick hacks to Brad's work (essentially I changed the name of the options, and added an exit(0) in the obvious place) I've tested this on qemu-0.8.2 and it works (though it conflicts with Brad Cambell's patch upon which it is based.) Anyhow, if you think this might be useful to other people, I'd be willing to spend some time cleaning it up and syncing it w/ cvs. Of course, if you don't mind modifying the install scripts, simply changing the reboot to a halt would do the same thing; but sometimes you don't want to do that, and patching qemu is more fun anyhow. (note how I was too lazy to make a new diff; the timestamps are unchanged.) diff -u -r1.210 vl.c --- vl.c 19 Aug 2006 12:37:52 -0000 1.210 +++ vl.c 20 Aug 2006 08:15:04 -0000 @@ -161,6 +161,7 @@ #endif int acpi_enabled = 1; int fd_bootchk = 1; +int exit_upon_reboot = 0; /***********************************************************/ /* x86 ISA bus support */ @@ -5611,7 +5612,12 @@ void qemu_system_reset_request(void) { - reset_requested = 1; + printf("Qemu_system_reset_requested\n"); + if ( exit_upon_reboot) { + exit(0); + } else { + reset_requested = 1; + } if (cpu_single_env) cpu_interrupt(cpu_single_env, CPU_INTERRUPT_EXIT); } @@ -5989,6 +5995,7 @@ QEMU_OPTION_smp, QEMU_OPTION_vnc, QEMU_OPTION_no_acpi, + QEMU_OPTION_exit_upon_reboot, }; typedef struct QEMUOption { @@ -6065,6 +6072,7 @@ { "usb", 0, QEMU_OPTION_usb }, { "cirrusvga", 0, QEMU_OPTION_cirrusvga }, { "no-acpi", 0, QEMU_OPTION_no_acpi }, + { "exit-upon-reboot", 0, QEMU_OPTION_exit_upon_reboot}, { NULL }, }; @@ -6708,6 +6716,10 @@ case QEMU_OPTION_no_acpi: acpi_enabled = 0; break; + case QEMU_OPTION_exit_upon_reboot: + printf("Rebooting Disabled\n"); + exit_upon_reboot = 1; + break; } } }