From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNVFI-0003lo-EV for qemu-devel@nongnu.org; Mon, 16 Feb 2015 18:38:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNVFD-00088y-Fh for qemu-devel@nongnu.org; Mon, 16 Feb 2015 18:38:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54023) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNVFD-00088c-7D for qemu-devel@nongnu.org; Mon, 16 Feb 2015 18:38:27 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1GNcO3u017766 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 16 Feb 2015 18:38:25 -0500 Message-ID: <54E27F6F.8070204@redhat.com> Date: Mon, 16 Feb 2015 16:38:23 -0700 From: Eric Blake MIME-Version: 1.0 References: <1424097865-3973-1-git-send-email-armbru@redhat.com> <1424097865-3973-10-git-send-email-armbru@redhat.com> In-Reply-To: <1424097865-3973-10-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bSpXPAbq9deDcGxRejSJ4EpIe6o29TWRk" Subject: Re: [Qemu-devel] [PATCH 09/13] qemu-img: Suppress unhelpful extra errors in convert, amend List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: kwolf@redhat.com, kraxel@redhat.com, stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --bSpXPAbq9deDcGxRejSJ4EpIe6o29TWRk Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/16/2015 07:44 AM, Markus Armbruster wrote: > img_convert() and img_amend() use qemu_opts_do_parse(), which reports > errors with qerror_report_err(). Its error messages aren't helpful > here, the caller reports one that actually makes sense. Reproducer: >=20 > $ qemu-img convert -o backing_format=3Draw in.img out.img > qemu-img: Invalid parameter 'backing_format' > qemu-img: Invalid options for file format 'raw' >=20 > To fix, propagate errors through qemu_opts_do_parse(). This lifts the > error reporting into callers. Drop it from img_convert() and > img_amend(), keep it in qemu_chr_parse_compat(), bdrv_img_create(). >=20 > Since I'm touching qemu_opts_do_parse() anyway, write a function > comment for it. >=20 > Signed-off-by: Markus Armbruster > --- > block.c | 5 ++++- > include/qemu/option.h | 3 ++- > qemu-char.c | 10 ++++++++-- > qemu-img.c | 25 +++++++++++++++++-------- > util/qemu-option.c | 19 +++++++++---------- > 5 files changed, 40 insertions(+), 22 deletions(-) >=20 > -int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char = *firstname) > +/** > + * Store into @opts options parsed from @params. Reads a bit awkwardly; maybe: Store options parsed from @params into @opts. > + * If @firstname is non-null, the first key=3Dvalue in @params may omi= t > + * key=3D, and is treated as if key was @firstname. > + * On error, store an error object through @errp if non-null. > + */ > +void qemu_opts_do_parse(QemuOpts *opts, const char *params, > + const char *firstname, Error **errp) > { Up to you if you want to improve that; either way, it's in a comment, so it doesn't affect correctness, so: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --bSpXPAbq9deDcGxRejSJ4EpIe6o29TWRk 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJU4n9vAAoJEKeha0olJ0NqLdUH/1AuUzjlPKhqU4YGBEp/nqDT ea5FFCglzyt0zqnxoHfB9As8iNt3FGvBqtEN3C5fgCUjIK56dE6zNzdxecDcRiwu z+S5TQkoKXxRzG8AOzWE3S/4XJ32QClfYrOqQ146Dv89P3u4m25phhpmHoL1kIaW oYUR3biqTPK0wYwYlcFdjsCynynmUu5/Fh5UnUtRNUNEs39HyNCNQR2rneEPGOUd V40h7xPzjFsljiq3FrUPpSWbSyzFvZctQsyADaUGhmUhitr+zZfLS5/CdZJDG/0N UrQV60Jp2pfS//qq6ZLT4XNQ3qBeBk3V2IPRsQXHhqTwVa19DbLzlGYwjOHHNIg= =G42K -----END PGP SIGNATURE----- --bSpXPAbq9deDcGxRejSJ4EpIe6o29TWRk--