qemu-img: Fix qemu-img convert -n

If -n is specified, it does not matter whether the output format and
protocol support image creation; building the creation options should
simply be skipped.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1423666727-20777-2-git-send-email-mreitz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Max Reitz 2015-02-11 09:58:46 -05:00 committed by Stefan Hajnoczi
parent fb13bbf2fd
commit 2e024cde1f
1 changed files with 26 additions and 24 deletions

View File

@ -1531,6 +1531,7 @@ static int img_convert(int argc, char **argv)
goto out;
}
if (!skip_create) {
if (!drv->create_opts) {
error_report("Format driver '%s' does not support image creation",
drv->format_name);
@ -1560,6 +1561,7 @@ static int img_convert(int argc, char **argv)
if (ret < 0) {
goto out;
}
}
/* Get backing file name if -o backing_file was used */
out_baseimg_param = qemu_opt_get(opts, BLOCK_OPT_BACKING_FILE);