Skip to content

Commit

Permalink
block: better error message for read only format name
Browse files Browse the repository at this point in the history
When user tries to use read-only whitelist format in the command line
option, failure message was "'foo' invalid format". It might be invalid
only for writable, but valid for read-only, so it is confusing. Give the
user easier to understand information.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
  • Loading branch information
Fam Zheng authored and stefanhaRH committed Aug 22, 2013
1 parent 893a8f6 commit 7780d47
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion blockdev.c
Expand Up @@ -487,7 +487,11 @@ static DriveInfo *blockdev_init(QemuOpts *all_opts,

drv = bdrv_find_whitelisted_format(buf, ro);
if (!drv) {
error_report("'%s' invalid format", buf);
if (!ro && bdrv_find_whitelisted_format(buf, !ro)) {
error_report("'%s' can be only used as read-only device.", buf);
} else {
error_report("'%s' invalid format", buf);
}
return NULL;
}
}
Expand Down

0 comments on commit 7780d47

Please sign in to comment.