summaryrefslogtreecommitdiff
path: root/hmp.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2011-11-22 17:58:31 -0200
committerLuiz Capitulino <lcapitulino@redhat.com>2011-12-06 11:40:01 -0200
commite42e818bf45f2f70cdd88a3864efcc3964039f37 (patch)
treeedc33f757981f6a1a5005b1ee3229b7e38589e46 /hmp.c
parent6d3962bf848ba06296554976f9fd86af805584bb (diff)
qapi: Convert cont
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'hmp.c')
-rw-r--r--hmp.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/hmp.c b/hmp.c
index 96e3ce18c1..d6235269b0 100644
--- a/hmp.c
+++ b/hmp.c
@@ -561,3 +561,35 @@ void hmp_pmemsave(Monitor *mon, const QDict *qdict)
qmp_pmemsave(addr, size, filename, &errp);
hmp_handle_error(mon, &errp);
}
+
+static void hmp_cont_cb(void *opaque, int err)
+{
+ Monitor *mon = opaque;
+
+ if (!err) {
+ hmp_cont(mon, NULL);
+ }
+}
+
+void hmp_cont(Monitor *mon, const QDict *qdict)
+{
+ Error *errp = NULL;
+
+ qmp_cont(&errp);
+ if (error_is_set(&errp)) {
+ if (error_is_type(errp, QERR_DEVICE_ENCRYPTED)) {
+ const char *device;
+
+ /* The device is encrypted. Ask the user for the password
+ and retry */
+
+ device = error_get_field(errp, "device");
+ assert(device != NULL);
+
+ monitor_read_block_device_key(mon, device, hmp_cont_cb, mon);
+ error_free(errp);
+ return;
+ }
+ hmp_handle_error(mon, &errp);
+ }
+}