Commit ffd8e8ff authored by Kevin Wolf's avatar Kevin Wolf
Browse files

qemu-img convert: Deprecate using -n and -o together



bdrv_create options specified with -o have no effect when skipping image
creation with -n, so this doesn't make sense. Warn against the misuse
and deprecate the combination so we can make it a hard error later.

Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
parent cf312932
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -305,6 +305,13 @@ to just export the entire image and then mount only /dev/nbd0p1 than
it is to reinvoke @command{qemu-nbd -c /dev/nbd0} limited to just a
subset of the image.

@subsection qemu-img convert -n -o (since 4.2.0)

All options specified in @option{-o} are image creation options, so
they have no effect when used with @option{-n} to skip image creation.
Silently ignored options can be confusing, so this combination of
options will be made an error in future versions.

@section Build system

@subsection Python 2 support (since 4.1.0)
+5 −0
Original line number Diff line number Diff line
@@ -2231,6 +2231,11 @@ static int img_convert(int argc, char **argv)
        goto fail_getopt;
    }

    if (skip_create && options) {
        warn_report("-o has no effect when skipping image creation");
        warn_report("This will become an error in future QEMU versions.");
    }

    s.src_num = argc - optind - 1;
    out_filename = s.src_num >= 1 ? argv[argc - 1] : NULL;