aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorShahar Havivi <shaharh@redhat.com>2010-03-06 00:26:13 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2010-03-17 10:41:38 -0500
commitfd04a2aedae37dc9f481225f445d04bddd1590b0 (patch)
treef3e5b92e299050cf4c590c2fcbe992178ba31185 /monitor.c
parent25b28f01d840c56c1323f2bb941da061a8003176 (diff)
Wrong error message in block_passwd command
Signed-off-by: Shahar Havivi <shaharh@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/monitor.c b/monitor.c
index f0ec84d52f..0448a70c10 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1057,6 +1057,7 @@ static int do_block_set_passwd(Monitor *mon, const QDict *qdict,
QObject **ret_data)
{
BlockDriverState *bs;
+ int err;
bs = bdrv_find(qdict_get_str(qdict, "device"));
if (!bs) {
@@ -1064,7 +1065,11 @@ static int do_block_set_passwd(Monitor *mon, const QDict *qdict,
return -1;
}
- if (bdrv_set_key(bs, qdict_get_str(qdict, "password")) < 0) {
+ err = bdrv_set_key(bs, qdict_get_str(qdict, "password"));
+ if (err == -EINVAL) {
+ qerror_report(QERR_DEVICE_NOT_ENCRYPTED, bdrv_get_device_name(bs));
+ return -1;
+ } else if (err < 0) {
qerror_report(QERR_INVALID_PASSWORD);
return -1;
}