Received: from eggs.gnu.org ([2001:4830:134:3::10]:55368) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUd1P-00056U-7L for qemu-devel@nongnu.org; Tue, 02 Aug 2016 12:58:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bUd1O-00026l-7L for qemu-devel@nongnu.org; Tue, 02 Aug 2016 12:58:27 -0400 Date: Tue, 2 Aug 2016 18:58:16 +0200 From: Kevin Wolf Message-ID: <20160802165816.GD5421@noname.redhat.com> References: <1468502894-18098-1-git-send-email-kwolf@redhat.com> <1468502894-18098-4-git-send-email-kwolf@redhat.com> <6b6bcb88-df06-a8ec-faa1-aa76c0de5139@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cvVnyQ+4j833TQvp" Content-Disposition: inline In-Reply-To: <6b6bcb88-df06-a8ec-faa1-aa76c0de5139@redhat.com> Subject: Re: [Qemu-devel] [PATCH v4 03/11] block: Accept node-name for blockdev-backup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: qemu-block@nongnu.org, eblake@redhat.com, berto@igalia.com, qemu-devel@nongnu.org --cvVnyQ+4j833TQvp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Am 18.07.2016 um 15:59 hat Max Reitz geschrieben: > On 14.07.2016 15:28, Kevin Wolf wrote: > > In order to remove the necessity to use BlockBackend names in the > > external API, we want to allow node-names everywhere. This converts > > blockdev-backup and the corresponding transaction action to accept a > > node-name without lifting the restriction that we're operating at a root > > node. > >=20 > > In case of an invalid device name, the command returns the GenericError > > error class now instead of DeviceNotFound, because this is what > > qmp_get_root_bs() returns. > >=20 > > Signed-off-by: Kevin Wolf > > --- > > blockdev.c | 35 ++++++++++------------------------- > > qapi/block-core.json | 2 +- > > qmp-commands.hx | 2 +- > > 3 files changed, 12 insertions(+), 27 deletions(-) > >=20 > > diff --git a/blockdev.c b/blockdev.c > > index 22bf03d..e5a5642 100644 > > --- a/blockdev.c > > +++ b/blockdev.c > > @@ -1954,38 +1954,31 @@ static void blockdev_backup_prepare(BlkActionSt= ate *common, Error **errp) > > { > > BlockdevBackupState *state =3D DO_UPCAST(BlockdevBackupState, comm= on, common); > > BlockdevBackup *backup; > > - BlockBackend *blk, *target; > > + BlockDriverState *bs, *target; > > Error *local_err =3D NULL; > > =20 > > assert(common->action->type =3D=3D TRANSACTION_ACTION_KIND_BLOCKDE= V_BACKUP); > > backup =3D common->action->u.blockdev_backup.data; > > =20 > > - blk =3D blk_by_name(backup->device); > > - if (!blk) { > > - error_setg(errp, "Device '%s' not found", backup->device); > > - return; > > - } > > - > > - if (!blk_is_available(blk)) { > > - error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, backup->device); > > + bs =3D qmp_get_root_bs(backup->device, errp); > > + if (!bs) { > > return; > > } > > =20 > > - target =3D blk_by_name(backup->target); > > + target =3D qmp_get_root_bs(backup->target, errp); >=20 > As of recently (0d978913), do_blockdev_backup() uses bdrv_lookup_bs() > for the target. While I think it was a mistake for that commit not to > change this place to bdrv_lookup_bs() as well, I think this patch should > either not touch this place at all, or it should fix it by using > bdrv_lookup_bs(). I'll first fix target in a separate patch and also update the documentation which 0d978913 neglected to do, and then I'll leave target alone in this patch. Kevin --cvVnyQ+4j833TQvp Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJXoNEnAAoJEH8JsnLIjy/W8b4P/RXPk+B5bAjPXjZdqJa+gyBF FgjPC4ih+o/OajhBCPX5CS8+1roN1jgRWyqNVnclxQPFipDDA0pfBupxnFTe5AUm G9tZeVJqwOze1dcg8X300kiqNiIbDexHmtuKpd07YXNR4Yvx+NTssx1nWwTOwnZZ 6AfGWS5L/gG/TBYdtRUrnkS9pKkHhAP2ETcpY2gcsRS9QalV7c2i5ArKLphvNzKX qZlY/7TjVxY8RFjF0k4KncZIPFNLgqlPme/ltZ+eBNeY6KJxrBqiialnzgRFiNwa dzaAx0UGDdpRfDN/M+JIidaCZ6MtsAgCsiwK0yX4YHdz+6Qeznp2ULBFZBXTxbX5 YOcdK12yS456jFNytb+EaOif19WN2pnRtdq0ra2UKmp+LfIHJwgz4TRgyxlPBk2D 3j9Vsmq0OBpiBEPok8zOrtc4RxBNzQJ8EFXGOWx2JeV4S1jgwBKGyDwPdhFl5TcP /MT8t4JdCNEtUDLRlaSBn8zXCsRVrxF/TbvxNx7dUJ8CjCkdy4l53X8hIDdE1Eq3 2c6dxJHf9HzEvnJI/Uo0HaqHfEmZH6Ofz6zuJz7rVIl3C9Is5OOvGam2XvQ7eurb ydFmCrvvNDE1Ua4O1oLSLvWAUF6NozBotzs6nsb5MX1MoiSdHhynn0af/NfqwdBA gwiwVDxyeIvUwa20KFvm =l8DY -----END PGP SIGNATURE----- --cvVnyQ+4j833TQvp--