From patchwork Mon Jan 14 10:01:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 211738 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7801E2C00A1 for ; Mon, 14 Jan 2013 21:02:25 +1100 (EST) Received: from localhost ([::1]:57877 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tugs2-00052b-TE for incoming@patchwork.ozlabs.org; Mon, 14 Jan 2013 05:02:22 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36023) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tugrs-00052R-Q3 for qemu-devel@nongnu.org; Mon, 14 Jan 2013 05:02:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tugrr-0006he-Qd for qemu-devel@nongnu.org; Mon, 14 Jan 2013 05:02:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43239) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tugrr-0006hG-IZ for qemu-devel@nongnu.org; Mon, 14 Jan 2013 05:02:11 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0EA28ee009476 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 14 Jan 2013 05:02:08 -0500 Received: from dhcp-5-188.str.redhat.com (dhcp-200-232.str.redhat.com [10.33.200.232]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0EA21Ul000748; Mon, 14 Jan 2013 05:02:07 -0500 From: Kevin Wolf To: anthony@codemonkey.ws Date: Mon, 14 Jan 2013 11:01:56 +0100 Message-Id: <1358157721-4131-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1358157721-4131-1-git-send-email-kwolf@redhat.com> References: <1358157721-4131-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 1/6] block: do not probe zero-sized disks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Paolo Bonzini 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 Signed-off-by: Kevin Wolf --- block.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/block.c b/block.c index 60873ea..14f8202 100644 --- a/block.c +++ b/block.c @@ -527,7 +527,7 @@ static int find_image_format(BlockDriverState *bs, const char *filename, int ret = 0; /* 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) { drv = bdrv_find_format("raw"); if (!drv) { ret = -ENOENT;