]> git.proxmox.com Git - mirror_qemu.git/commitdiff
block: better error message for read only format name
authorFam Zheng <famz@redhat.com>
Thu, 22 Aug 2013 07:36:59 +0000 (15:36 +0800)
committerStefan Hajnoczi <stefanha@redhat.com>
Thu, 22 Aug 2013 12:30:03 +0000 (14:30 +0200)
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>
blockdev.c

index bc7016a8d4bb50689ff43b4029f8af23eb7ed1c0..d3500c61337f2e12332604c2afa535d2dfffd915 100644 (file)
@@ -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;
         }
     }