From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:46475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwIQL-000090-Ry for qemu-devel@nongnu.org; Wed, 24 Aug 2011 14:43:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QwIQJ-0006Mp-E6 for qemu-devel@nongnu.org; Wed, 24 Aug 2011 14:43:37 -0400 Received: from e4.ny.us.ibm.com ([32.97.182.144]:51634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwIQJ-0006MR-AQ for qemu-devel@nongnu.org; Wed, 24 Aug 2011 14:43:35 -0400 Received: from d01relay05.pok.ibm.com (d01relay05.pok.ibm.com [9.56.227.237]) by e4.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p7OIKFg0003119 for ; Wed, 24 Aug 2011 14:20:15 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay05.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p7OIhRpY174866 for ; Wed, 24 Aug 2011 14:43:27 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p7OIhR28010684 for ; Wed, 24 Aug 2011 15:43:27 -0300 From: Anthony Liguori Date: Wed, 24 Aug 2011 13:43:02 -0500 Message-Id: <1314211389-28915-8-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1314211389-28915-1-git-send-email-aliguori@us.ibm.com> References: <1314211389-28915-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [PATCH 07/14] qerror: add additional parameter to QERR_DEVICE_ENCRYPTED List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Anthony Liguori , Michael Roth , Luiz Capitulino Changing an encrypted block device requires a flow of: 1) change device 2) receive error from change 3) block_passwd DeviceEncrypted receives the device name but with a block backend with multiple backing files, any one of the backing files could be encrypted. From a UI perspective, you have no way of knowing which file is encrypted without parsing the qcow2 files :-/ Add the actual encrypted filename to the error message so that a UI can display that information to the user. Signed-off-by: Anthony Liguori --- monitor.c | 3 ++- qerror.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/monitor.c b/monitor.c index 5595565..5cb36cd 100644 --- a/monitor.c +++ b/monitor.c @@ -5319,7 +5319,8 @@ int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, } if (monitor_ctrl_mode(mon)) { - qerror_report(QERR_DEVICE_ENCRYPTED, bdrv_get_device_name(bs)); + qerror_report(QERR_DEVICE_ENCRYPTED, bdrv_get_device_name(bs), + bdrv_get_encrypted_filename(bs)); return -1; } diff --git a/qerror.h b/qerror.h index 4fe24aa..3bbff5c 100644 --- a/qerror.h +++ b/qerror.h @@ -64,7 +64,7 @@ QError *qobject_to_qerror(const QObject *obj); "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }" #define QERR_DEVICE_ENCRYPTED \ - "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s } }" + "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s, 'filename': %s} }" #define QERR_DEVICE_INIT_FAILED \ "{ 'class': 'DeviceInitFailed', 'data': { 'device': %s } }" -- 1.7.4.1