block/qcow: Improve error when opening qcow2 files as qcow

Reported-by: radmehrsaeed7@gmail.com
Fixes: https://bugs.launchpad.net/bugs/1832914
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
John Snow 2019-06-26 17:53:01 -04:00 committed by Kevin Wolf
parent 1a8c091c4e
commit 197bfa7da7

View File

@ -156,7 +156,12 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
goto fail;
}
if (header.version != QCOW_VERSION) {
error_setg(errp, "Unsupported qcow version %" PRIu32, header.version);
error_setg(errp, "qcow (v%d) does not support qcow version %" PRIu32,
QCOW_VERSION, header.version);
if (header.version == 2 || header.version == 3) {
error_append_hint(errp, "Try the 'qcow2' driver instead.\n");
}
ret = -ENOTSUP;
goto fail;
}