qerror: Extend QERR_DEVICE_ENCRYPTED
authorLuiz Capitulino <lcapitulino@redhat.com>
Tue, 13 Dec 2011 19:18:30 +0000 (17:18 -0200)
committerLuiz Capitulino <lcapitulino@redhat.com>
Wed, 18 Jan 2012 12:23:39 +0000 (10:23 -0200)
Include the name of the encrypted file.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
monitor.c
qerror.h
qmp.c

index bd4bc4f5b0da63660f6a7f609dce5a6b9fd15ec8..f85a9d2499f6311942425bd1ba4847a31a3cb9af 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -4682,7 +4682,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;
     }
 
index efda232db389f0265787123619543425d1b127a6..27800fe10f975efb384937470c995ad338934e9c 100644 (file)
--- a/qerror.h
+++ b/qerror.h
@@ -70,7 +70,7 @@ QError *qobject_to_qerror(const QObject *obj);
     "{ 'class': 'CommandDisabled', '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 } }"
diff --git a/qmp.c b/qmp.c
index f218485ef18c428e62e0c2eb0cb017407ae2205a..9c9ea629ede67fa7c868337a3be072707bc9ae0c 100644 (file)
--- a/qmp.c
+++ b/qmp.c
@@ -135,7 +135,8 @@ static void encrypted_bdrv_it(void *opaque, BlockDriverState *bs)
     Error **err = opaque;
 
     if (!error_is_set(err) && bdrv_key_required(bs)) {
-        error_set(err, QERR_DEVICE_ENCRYPTED, bdrv_get_device_name(bs));
+        error_set(err, QERR_DEVICE_ENCRYPTED, bdrv_get_device_name(bs),
+                  bdrv_get_encrypted_filename(bs));
     }
 }