aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/monitor.c b/monitor.c
index ba76f3416d..27c696b2d4 100644
--- a/monitor.c
+++ b/monitor.c
@@ -772,6 +772,22 @@ static void do_eject(Monitor *mon, const QDict *qdict, QObject **ret_data)
eject_device(mon, bs, force);
}
+static void do_block_set_passwd(Monitor *mon, const QDict *qdict,
+ QObject **ret_data)
+{
+ BlockDriverState *bs;
+
+ bs = bdrv_find(qdict_get_str(qdict, "device"));
+ if (!bs) {
+ qemu_error_new(QERR_DEVICE_NOT_FOUND, qdict_get_str(qdict, "device"));
+ return;
+ }
+
+ if (bdrv_set_key(bs, qdict_get_str(qdict, "password")) < 0) {
+ qemu_error_new(QERR_INVALID_PASSWORD);
+ }
+}
+
static void do_change_block(Monitor *mon, const char *device,
const char *filename, const char *fmt)
{