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 <aligu...@us.ibm.com> --- 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