From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xwss1-0006Vv-Qf for qemu-devel@nongnu.org; Fri, 05 Dec 2014 08:24:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xwsrv-0005wc-Ia for qemu-devel@nongnu.org; Fri, 05 Dec 2014 08:24:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47761) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xwsrv-0005wY-Aj for qemu-devel@nongnu.org; Fri, 05 Dec 2014 08:24:23 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sB5DOMrw010460 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 5 Dec 2014 08:24:22 -0500 Message-ID: <5481B205.5040301@redhat.com> Date: Fri, 05 Dec 2014 06:24:21 -0700 From: Eric Blake MIME-Version: 1.0 References: <1417774136-30001-1-git-send-email-mreitz@redhat.com> <1417774136-30001-3-git-send-email-mreitz@redhat.com> In-Reply-To: <1417774136-30001-3-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="QgaV7cqphF0u9lNM7wRXsHPTV6lwJMNmX" Subject: Re: [Qemu-devel] [PATCH v2 2/4] hmp: Use blockdev-change-medium for change command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Markus Armbruster , Stefan Hajnoczi , Luiz Capitulino This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --QgaV7cqphF0u9lNM7wRXsHPTV6lwJMNmX Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 12/05/2014 03:08 AM, Max Reitz wrote: > Use separate code paths for the two overloaded functions of the 'change= ' > HMP command, and invoke the 'blockdev-change-medium' QMP command if use= d > on a block device (by calling qmp_blockdev_change_medium()). >=20 > Signed-off-by: Max Reitz > --- > hmp.c | 27 +++++++++++++++------------ > 1 file changed, 15 insertions(+), 12 deletions(-) Reviewed-by: Eric Blake > + } else { > + qmp_blockdev_change_medium(device, target, !!arg, arg, &err); > + if (err && > + error_get_class(err) =3D=3D ERROR_CLASS_DEVICE_ENCRYPTED) = { > + error_free(err); > + monitor_read_block_device_key(mon, device, NULL, NULL); > return; Hmm. Not a problem with this patch (which is just reorganizing control flow), but a possible design issue. The old 'change' QMP command cannot provide the encryption code, hence it cannot succeed when changing to an encrypted media. But now that we are adding a new QMP command, we could possibly rectify that matter. However, the way I'm envisioning that is that blockdev-change-medium gains an optional parameter for encryption key. Then the HMP command gains a new optional parameter for specifying the key, and the logic flow would look a bit more like: qmp_blockdev_change_medium(device, target, !!arg, arg, !!key, key, &err); if (err && error_get_class(err) =3D=3D ERROR_CLASS_DEVICE_ENCRYPTED && !key) { error_free(err); key =3D prompt_for_key_from_monitor; qmp_blockdev_change_medium(device, target, !!arg, arg, true, key, &err); } which would mean that a QMP command can now supply the key in one command, rather than HMP being the only way to supply a password because of how it does a two-step process (that is, monitor_read_block_device_key isn't really accessible from QMP). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --QgaV7cqphF0u9lNM7wRXsHPTV6lwJMNmX 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 iQEcBAEBCAAGBQJUgbIFAAoJEKeha0olJ0NqKysH/37sFP0r7EYqtanUR/Wi0FsU QFhFYN40JcpSFoGIP0aV2IVPf0zXHzPXX1um+ap8FGOe5DH8bV0qdpV9+ZD9oVNa AUpp66tfZKxRgYrSmwi1jVWd3iXnVUtFPx+SgPLMd+RnZH13ftZN4HHABDzrmos9 zriSI7PQ9xe99W01FFXymSFErPjozEVaEfcjtzJZITVrnSGyXmu5CJc595gS+izv hku7z9f9Y8Yw8jG60ZDaVl8sVEHW4QD6/neepZrRLWVBPjU7o2H63gsLlHSC0fdS gB1JYZAfbK13gSJtfyqIPvghZnUvA2u/vBjgEk2P2UbvuPh2davTDAk7Ddjs0FA= =m36W -----END PGP SIGNATURE----- --QgaV7cqphF0u9lNM7wRXsHPTV6lwJMNmX--