From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ME1aU-0003cS-EB for qemu-devel@nongnu.org; Tue, 09 Jun 2009 09:42:02 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ME1aP-0003a6-Ot for qemu-devel@nongnu.org; Tue, 09 Jun 2009 09:42:02 -0400 Received: from [199.232.76.173] (port=33519 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ME1aP-0003Zz-If for qemu-devel@nongnu.org; Tue, 09 Jun 2009 09:41:57 -0400 Received: from rv-out-0708.google.com ([209.85.198.247]:14681) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1ME1aP-0007HJ-6Y for qemu-devel@nongnu.org; Tue, 09 Jun 2009 09:41:57 -0400 Received: by rv-out-0708.google.com with SMTP id f25so1266022rvb.2 for ; Tue, 09 Jun 2009 06:41:54 -0700 (PDT) Message-ID: <4A2E6698.30208@gmail.com> Date: Tue, 09 Jun 2009 07:41:44 -0600 From: David Ahern MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] don't exit if cdrom media fails to open List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This patch allows a VM to continue even if the cdrom image is not accessible at VM boot time. It allows a boot progression similar to real hardware (e.g., try cd, then disk). For example, qemu-system-x86_64 -cdrom /dev/dvd -hda disk.img -boot dc If there is no media in the tray, qemu currently exits with the message: qemu: could not open disk image /dev/dvd With this patch, the message is still displayed, but qemu continues. It first tries to boot from the cdrom and then falls back to the disk. Signed-off-by: David Ahern --- diff --git a/vl.c b/vl.c index fcf8532..bd3709c 100644 --- a/vl.c +++ b/vl.c @@ -152,6 +152,7 @@ int main(int argc, char **argv) #include "qemu-char.h" #include "cache-utils.h" #include "block.h" +#include "block_int.h" #include "dma.h" #include "audio/audio.h" #include "migration.h" @@ -2551,7 +2552,8 @@ int drive_init(struct drive_opt *arg, int snapshot, void *opaque) if (bdrv_open2(bdrv, file, bdrv_flags, drv) < 0) { fprintf(stderr, "qemu: could not open disk image %s\n", file); - return -1; + if (bdrv->type != BDRV_TYPE_CDROM) + return -1; } if (bdrv_key_required(bdrv)) autostart = 0;