From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=37219 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OMR6D-0001aR-BG for qemu-devel@nongnu.org; Wed, 09 Jun 2010 15:38:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OMR6C-0006DC-03 for qemu-devel@nongnu.org; Wed, 09 Jun 2010 15:38:05 -0400 Received: from e35.co.us.ibm.com ([32.97.110.153]:43143) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OMR6B-0006Cw-RE for qemu-devel@nongnu.org; Wed, 09 Jun 2010 15:38:03 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e35.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id o59JV64T015315 for ; Wed, 9 Jun 2010 13:31:06 -0600 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id o59Jc0ra189786 for ; Wed, 9 Jun 2010 13:38:01 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o59JbuC0017147 for ; Wed, 9 Jun 2010 13:37:56 -0600 Date: Wed, 9 Jun 2010 14:37:48 -0500 From: Ryan Harper Subject: Re: [Qemu-devel] [PATCH] Add an error_report when failing to open due to block-drv-whitelist Message-ID: <20100609193748.GY5280@us.ibm.com> References: <20100609192809.GX5280@us.ibm.com> <4C0FED14.1010607@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C0FED14.1010607@codemonkey.ws> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Ryan Harper , qemu-devel@nongnu.org * Anthony Liguori [2010-06-09 14:36]: > On 06/09/2010 02:28 PM, Ryan Harper wrote: > >When configure qemu with --block-drv-whitelist we don't report when we are > >blocked by the white list and the resulting error message is misleading: > > > >./configure --target-list=x86_64-softmmu \ > > --block-drv-whitelist=qcow2,raw,host_device,host_cdrom > > > >x86_64-softmmu/qemu-system-x86_64 -L pc-bios -m 512 -drive \ > > file=fedora9_32_20G.qcow2,if=ide -monitor stdio > >qemu: could not open disk image fedora9_32_20G.qcow2: Inappropriate ioctl > >for device > > > >Which might lead one to look at the bdrv probe functions for floppy/cdrom > >because we indeed will get an ioctl failure stored in errno and we report > >this > >in vl.c when we get a non-zero return value from bdrv_open(). > > > >This patch adds an error report when we fail the whitelist and changes the > >errno > >value to ENOPROTOOPT which was the closest thing I could think of that > >matched > >the actual error. > > > >Now we get the following output on whitelist failure: > > > >x86_64-softmmu/qemu-system-x86_64 -L pc-bios -m 512 -drive \ > > file=fedora9_32_20G.qcow2,if=ide -monitor stdio > >qemu-system-x86_64: -drive file=fedora9_32_20G.qcow2,if=ide: > >block-drv-whitelist prevents using format 'file' > >qemu: could not open disk image fedora9_32_20G.qcow2: Protocol not > >supported > > > > Do you really have to say raw and file in the whitelist? Is that what > the source of the problem is? I have to add 'file' to the whitelist string to get the above command line to work. > > Regards, > > Anthony Liguori > > >Signed-off-by: Ryan Harper > >--- > > block.c | 3 +++ > > 1 files changed, 3 insertions(+), 0 deletions(-) > > > >diff --git a/block.c b/block.c > >index 39724c1..ffcf7f2 100644 > >--- a/block.c > >+++ b/block.c > >@@ -403,6 +403,9 @@ static int bdrv_open_common(BlockDriverState *bs, > >const char *filename, > > pstrcpy(bs->filename, sizeof(bs->filename), filename); > > > > if (use_bdrv_whitelist&& !bdrv_is_whitelisted(drv)) { > >+ error_report("block-drv-whitelist prevents using format '%s'", > >drv->format_name); > >+ /* reset errno since we're failing because of whitelist > >restrictions */ > >+ errno = EPROTONOSUPPORT; > > return -ENOTSUP; > > } > > > > -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx ryanh@us.ibm.com