qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] don't exit if cdrom media fails to open
@ 2009-06-09 13:41 David Ahern
  2009-06-09 22:22 ` Mark McLoughlin
  0 siblings, 1 reply; 4+ messages in thread
From: David Ahern @ 2009-06-09 13:41 UTC (permalink / raw)
  To: qemu-devel

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 <dsahern@gmail.com>

---

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;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-10 13:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-09 13:41 [Qemu-devel] [PATCH] don't exit if cdrom media fails to open David Ahern
2009-06-09 22:22 ` Mark McLoughlin
2009-06-09 23:34   ` David Ahern
2009-06-10 13:47     ` Cole Robinson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).