From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VePSk-0002PH-W7 for qemu-devel@nongnu.org; Thu, 07 Nov 2013 08:17:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VePSg-0007a5-4l for qemu-devel@nongnu.org; Thu, 07 Nov 2013 08:17:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VePSf-0007Zy-R9 for qemu-devel@nongnu.org; Thu, 07 Nov 2013 08:17:26 -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 rA7DHP4c008176 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 7 Nov 2013 08:17:25 -0500 Message-ID: <527B92E4.4080601@redhat.com> Date: Thu, 07 Nov 2013 06:17:24 -0700 From: Eric Blake MIME-Version: 1.0 References: <1383809692-11158-1-git-send-email-famz@redhat.com> In-Reply-To: <1383809692-11158-1-git-send-email-famz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="QgfgGIHkjuRJpuHoSIlgaFtISIJ02kKBB" Subject: Re: [Qemu-devel] [PATCH] block: Print its file name if backing file opening failed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --QgfgGIHkjuRJpuHoSIlgaFtISIJ02kKBB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 11/07/2013 12:34 AM, Fam Zheng wrote: > If backing file doesn't exist, the error message is confusing and > misleading: >=20 >=20 > This is not intuitive. It's better to have the missing file's name in > the error message. With this patch: >=20 > $ qemu-io -c 'read 0 512' /tmp/a.qcow2 > qemu-io: can't open device /tmp/a.qcow2: Could not open backing > file: Could not open '/stor/vm/arch.raw': No such file or directory= > no file open, try 'help open' >=20 > Which is a little bit better. Indeed. Are you trying to get this into 1.7? >=20 > Signed-off-by: Fam Zheng > --- > block.c | 3 ++- > block/raw-posix.c | 1 - > block/raw-win32.c | 1 - > tests/qemu-iotests/051.out | 2 +- > tests/qemu-iotests/069.out | 2 +- > 5 files changed, 4 insertions(+), 5 deletions(-) >=20 > diff --git a/block.c b/block.c > index f706634..a8dbcfc 100644 > --- a/block.c > +++ b/block.c > @@ -1009,7 +1009,8 @@ int bdrv_open_backing_file(BlockDriverState *bs, = QDict *options, Error **errp) > bdrv_unref(bs->backing_hd); > bs->backing_hd =3D NULL; > bs->open_flags |=3D BDRV_O_NO_BACKING; > - error_propagate(errp, local_err); > + error_setg(errp, "Could not open backing file: %s", > + error_get_pretty(local_err)); > return ret; Needs a v2, that doesn't leak local_err. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --QgfgGIHkjuRJpuHoSIlgaFtISIJ02kKBB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSe5LkAAoJEKeha0olJ0NqTUwH/0MLcEHLrs37P2poMue81eJC uQ9JtK2ylmAkfFh8o6BbP+ajP8zW9h5Z5IVdttUmq5pOtVlTWPJgcZh+KQITJMqL iVmTMR12RMFLMjN1B5Z4BbXfAfGevY38t8HsEU+oSOcexmSz24WzJ5nZL6wRcXqy nKJ3GutX4eFnhlAoSQ4a+YTsFRRp7/gqnhBmiGsRBvmYAkJB7gkJ3jdjjLThNT2W nJBNSfbK64s4TtYMWXqmT1n48nADevClnG4wS7mVf6B6HeV3DiMez5atX2Wab0vx VbdQmWQFRL9ZSvuOvDvWiBHGm/I4TA67T/OOVBYZ08CrG+7letg0RqoULq5xh2s= =CAPQ -----END PGP SIGNATURE----- --QgfgGIHkjuRJpuHoSIlgaFtISIJ02kKBB--