From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOwDl-0002rU-Hf for qemu-devel@nongnu.org; Fri, 20 Feb 2015 17:38:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YOwDg-0003ji-Vb for qemu-devel@nongnu.org; Fri, 20 Feb 2015 17:38:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOwDg-0003je-Ns for qemu-devel@nongnu.org; Fri, 20 Feb 2015 17:38:48 -0500 Message-ID: <54E7B74C.7010307@redhat.com> Date: Fri, 20 Feb 2015 15:38:04 -0700 From: Eric Blake MIME-Version: 1.0 References: <49b845c4a362ffd64ec78bbe0b165cd7addd2a4b.1424439295.git.berto@igalia.com> In-Reply-To: <49b845c4a362ffd64ec78bbe0b165cd7addd2a4b.1424439295.git.berto@igalia.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2BwgRk073RupqjRWDm27n2obl2qfhq3rT" Subject: Re: [Qemu-devel] [PATCH 2/3] block: Add QMP support for streaming to an intermediate layer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia , qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --2BwgRk073RupqjRWDm27n2obl2qfhq3rT Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/20/2015 06:53 AM, Alberto Garcia wrote: > This adds the 'top' parameter to the 'block-stream' QMP command and > checks that its value is valid before passing it to stream_start(). >=20 > Signed-off-by: Alberto Garcia > --- > blockdev.c | 19 +++++++++++++++---- > hmp.c | 2 +- > include/qapi/qmp/qerror.h | 3 +++ > qapi/block-core.json | 18 ++++++++++++++---- > qmp-commands.hx | 2 +- > 5 files changed, 34 insertions(+), 10 deletions(-) > @@ -2123,12 +2125,21 @@ void qmp_block_stream(const char *device, > aio_context =3D bdrv_get_aio_context(bs); > aio_context_acquire(aio_context); > =20 > - if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_STREAM, errp)) { > + if (has_top) { > + top_bs =3D bdrv_find_backing_image(bs, top); > + if (top_bs =3D=3D NULL) { > + error_set(errp, QERR_TOP_NOT_FOUND, top); > + goto out; > + } If I understand correctly, bdrv_find_backing_image has problems for backing nodes that don't have a file name. Given our shift towards node names, I think we really want to target node names rather than file names when specifying which node we will use as the top bound receiving the stream operations. > +++ b/include/qapi/qmp/qerror.h > @@ -127,6 +127,9 @@ void qerror_report_err(Error *err); > #define QERR_SET_PASSWD_FAILED \ > ERROR_CLASS_GENERIC_ERROR, "Could not set password" > =20 > +#define QERR_TOP_NOT_FOUND \ > + ERROR_CLASS_GENERIC_ERROR, "Top '%s' not found" > + Please don't. Just use error_setg() at the right place with the direct message (existing QERR_ macros are a legacy holdover, and we shouldn't be creating more of them). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --2BwgRk073RupqjRWDm27n2obl2qfhq3rT 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/ iQEcBAEBCAAGBQJU57dMAAoJEKeha0olJ0NqDksH/3jvH9CgMKD4kGkgqRxPkejj Tuv0GVIML95LdFualtXGOcnKH14pE2e0befSeB526psoBwl4XqY4OWelL6HSM1Kr JHkeOC9kYGuuDnxpdUjnqffvjwP5HKnteBiMEiWet8gKtJHRO+kAJldJ+IEqHN3y NDGm7h0CCowJkpLBpMPfUd7/bQRzZUt5lb5KYkIqShUaE6krrOsv79ocW2F2Ed5L w/8zmJoNUze9QAauZsuON+LgO5ImHKu6X4zcWDE+wlG2X4jrHpK75pmWDkp/8ALM TFqoIE9eN6TG1Q1FEnGrThFI4Dt/Xk6AxqqftoiaFHME5IECRHeoFh6T+dgVlfM= =LuHQ -----END PGP SIGNATURE----- --2BwgRk073RupqjRWDm27n2obl2qfhq3rT--