From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51399) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtJI8-0003zD-6U for qemu-devel@nongnu.org; Thu, 10 Jan 2013 09:39:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtJI7-0004IH-1P for qemu-devel@nongnu.org; Thu, 10 Jan 2013 09:39:36 -0500 Received: from mail-vc0-f175.google.com ([209.85.220.175]:55195) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtJI6-0004Hu-Tq for qemu-devel@nongnu.org; Thu, 10 Jan 2013 09:39:34 -0500 Received: by mail-vc0-f175.google.com with SMTP id fy7so464828vcb.6 for ; Thu, 10 Jan 2013 06:39:34 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 10 Jan 2013 15:39:27 +0100 Message-Id: <1357828767-2327-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH] block: do not probe zero-sized disks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com A blank CD or DVD is visible as a zero-sized disks. Probing such disks will lead to an EIO and a failure to start the VM. Treating them as raw is a better solution. Signed-off-by: Paolo Bonzini --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.c b/block.c index c05875f..b9da10e 100644 --- a/block.c +++ b/block.c @@ -532,7 +532,7 @@ static int find_image_format(const char *filename, BlockDriver **pdrv) } /* Return the raw BlockDriver * to scsi-generic devices or empty drives */ - if (bs->sg || !bdrv_is_inserted(bs)) { + if (bs->sg || !bdrv_is_inserted(bs) || bdrv_getlength(bs) == 0) { bdrv_delete(bs); drv = bdrv_find_format("raw"); if (!drv) { -- 1.8.1