From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwsVC-0005bp-SV for qemu-devel@nongnu.org; Tue, 17 Jun 2014 08:28:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwsV4-00052B-DM for qemu-devel@nongnu.org; Tue, 17 Jun 2014 08:28:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19149) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwsV4-000527-5F for qemu-devel@nongnu.org; Tue, 17 Jun 2014 08:28:30 -0400 Message-ID: <53A0346B.4010809@redhat.com> Date: Tue, 17 Jun 2014 06:28:27 -0600 From: Eric Blake MIME-Version: 1.0 References: <840e93375c89f86143ae3046556ca46d271eebb3.1402683788.git.jcody@redhat.com> In-Reply-To: <840e93375c89f86143ae3046556ca46d271eebb3.1402683788.git.jcody@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6Il9OlRP2AAa8wkwnKdERvBjquAevSXLJ" Subject: Re: [Qemu-devel] [PATCH v5 05/10] block: Accept node-name arguments for block-commit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Cody , qemu-devel@nongnu.org Cc: kwolf@redhat.com, benoit.canet@irqsave.net, pkrempa@redhat.com, famz@redhat.com, stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --6Il9OlRP2AAa8wkwnKdERvBjquAevSXLJ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/13/2014 12:52 PM, Jeff Cody wrote: > This modifies the block operation block-commit so that it will > accept node-name arguments for either 'top' or 'base' BDS. >=20 > void qmp_block_commit(const char *device, > bool has_base, const char *base, > + bool has_base_node_name, const char *base_node_n= ame, > bool has_top, const char *top, > + bool has_top_node_name, const char *top_node_nam= e, > bool has_speed, int64_t speed, > Error **errp) > { > - BlockDriverState *bs; > - BlockDriverState *base_bs, *top_bs; > + BlockDriverState *bs =3D NULL; > + BlockDriverState *base_bs =3D NULL; > + BlockDriverState *top_bs =3D NULL; > Error *local_err =3D NULL; > /* This will be part of the QMP command, if/when the > * BlockdevOnError change for blkmirror makes it in > @@ -1940,20 +1943,33 @@ void qmp_block_commit(const char *device, > /* drain all i/o before commits */ > bdrv_drain_all(); > =20 > - bs =3D bdrv_find(device); > - if (!bs) { > - error_set(errp, QERR_DEVICE_NOT_FOUND, device); On IRC, we discussed that libvirt would like to rely on QERR_DEVICE_NOT_FOUND (aka "class":"DeviceNotFound") as a witness probe for whether qemu supports optional 'top' (which is a rough approximation for whether qemu supports active commit, other than it mis-diagnoses qemu 2.0; but libvirt probably wants to just require qemu 2.1 for active commit anyways). Compare: on 2.1: {"execute":"block-commit","arguments":{"device":"no-such"}} {"error": {"class": "DeviceNotFound", "desc": "Device 'no-such' not found= "}} on 1.7: {"execute":"block-commit","arguments":{"device":"no-such"}} {"error": {"class": "GenericError", "desc": "Parameter 'top' is missing"}= } It might be worth a comment in the code that the device not found error from a failed bdrv_find() should occur as early as possible, at least in the case where all optional parameters are omitted, to serve as a libvirt probe point (it is okay for the code to have various GenericError sanity checks occur before the bdrv_find, so long as those checks can only be triggered when optional parameters are present - but again, worth mentioning in a comment added to the code). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --6Il9OlRP2AAa8wkwnKdERvBjquAevSXLJ 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/ iQEcBAEBCAAGBQJToDRrAAoJEKeha0olJ0NqUp8H/R5Wr7gwBU7XUHeYj5AAHMEi KrffJwf8DKm7MNSUnp4AK/rkmxA7Nfi/Sdfa2xbMMwL/TPqbl8j9DKPoHoLxmgAC GtrYAGGvQc/xkwEvxYqZR5yvaZAPYJMdHzPhQUdFEZduKQhHcCODf64Z9a2tM1FT S69dLuxskVtvoaXyBCHyn3qto0egKcyKHpE+Ncd2bQ5kw+LgHc3PAFSBoL8RnkBO Ik1d3VZUofZa3S+l3GfsNp9g9TZkfBMYrzjnATD9h7BR6oWSk8SXcvQWpP+XMEGt Dy0kp0USgaOrTAbfrU2aQ2F+cf1aLmOW9ee01RUqCv5asHFCQXeAhiDsYAMCrzc= =8Dot -----END PGP SIGNATURE----- --6Il9OlRP2AAa8wkwnKdERvBjquAevSXLJ--