From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGZGD-0003KU-Ru for qemu-devel@nongnu.org; Wed, 28 Jan 2015 15:30:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGZG8-0007TT-BB for qemu-devel@nongnu.org; Wed, 28 Jan 2015 15:30:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41234) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGZG8-0007TF-02 for qemu-devel@nongnu.org; Wed, 28 Jan 2015 15:30:44 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0SKUhqw009107 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 28 Jan 2015 15:30:43 -0500 Message-ID: <54C946F1.2080701@redhat.com> Date: Wed, 28 Jan 2015 13:30:41 -0700 From: Eric Blake MIME-Version: 1.0 References: <1422387983-32153-1-git-send-email-mreitz@redhat.com> <1422387983-32153-44-git-send-email-mreitz@redhat.com> In-Reply-To: <1422387983-32153-44-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ED7bvQlj3bLTtVguBGpXMkQvFA38j96rg" Subject: Re: [Qemu-devel] [PATCH RESEND 43/50] blockdev: Implement change with basic operations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Fam Zheng , Jeff Cody , Markus Armbruster , Stefan Hajnoczi , John Snow This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ED7bvQlj3bLTtVguBGpXMkQvFA38j96rg Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/27/2015 12:46 PM, Max Reitz wrote: > Implement 'change' on block devices by calling blockdev-open-tray, > blockdev-remove-medium, blockdev-insert-medium (a variation of that > which does not need a node-name) and blockdev-close-tray. >=20 > Signed-off-by: Max Reitz > --- > blockdev.c | 191 +++++++++++++++++++++++------------------------------= -------- > 1 file changed, 72 insertions(+), 119 deletions(-) >=20 > + > + qmp_blockdev_open_tray(device, false, false, &err); > + if (err) { > + error_propagate(errp, err); > + return; > + } > + > + qmp_blockdev_remove_medium(device, &err); > + if (err) { > + error_propagate(errp, err); > + return; > + } > + > + qmp_blockdev_insert_anon_medium(device, medium_bs, &err); > + if (err) { > + error_propagate(errp, err); > + return; > + } > + > + qmp_blockdev_close_tray(device, errp); So if we fail anywhere in the middle, the device is left in an unspecified state, and a followup query-block would be needed to learn where we failed. I guess that's life when you use a high-level command instead of chaining low-level ones yourself. I can live with it. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --ED7bvQlj3bLTtVguBGpXMkQvFA38j96rg 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/ iQEcBAEBCAAGBQJUyUbyAAoJEKeha0olJ0NqbNUH/Aui4D5wIIs1Y9gI7Msbiknr nSKqfJvpRCUkuj/f5DCcNKTzE3X2oa80I34Ua0Wpm6zkkI1pQx8i/b1cKOQrEN2h LRPh/sXSA9QsY4Y/lm7u4/Bwvf5+AXSVcaWL6Uipr+w/r+VxltVJkwtpTIkQI0v1 Zq1Q73s85BIy/0PP/papCD78xxrYNNmngSbtGdsczj+R67bry79bqzsRA9grtyAH 6onde5/6PchztYKLQ5uz6B9rJk+2Xtxb2528HZ58dvtuz7DkmCMfWd5edpetC2UD EjZsONceCah1yrcTv6TduwpSrtlHXCHBJcH4kMDRYsJIAK8UZLc0CkzFvVAmnqw= =Yl/x -----END PGP SIGNATURE----- --ED7bvQlj3bLTtVguBGpXMkQvFA38j96rg--