Commit 7780d472 authored by Fam Zheng's avatar Fam Zheng Committed by Stefan Hajnoczi
Browse files

block: better error message for read only format name



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: default avatarFam Zheng <famz@redhat.com>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent 893a8f62
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -487,7 +487,11 @@ static DriveInfo *blockdev_init(QemuOpts *all_opts,

        drv = bdrv_find_whitelisted_format(buf, ro);
        if (!drv) {
            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;
        }
    }