qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu-img convert: Deprecate using -n and -o together
@ 2019-08-09  9:11 Kevin Wolf
  2019-08-09 12:51 ` Max Reitz
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Kevin Wolf @ 2019-08-09  9:11 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel, mreitz

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: Kevin Wolf <kwolf@redhat.com>
---
 qemu-img.c           | 5 +++++
 qemu-deprecated.texi | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/qemu-img.c b/qemu-img.c
index 79983772de..d9321f6418 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -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;
 
diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
index fff07bb2a3..7673d079c5 100644
--- a/qemu-deprecated.texi
+++ b/qemu-deprecated.texi
@@ -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. This
+combination never made sense and shows that the user misunderstood the
+effect of the options, so this will be made an error in future versions.
+
 @section Build system
 
 @subsection Python 2 support (since 4.1.0)
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] qemu-img convert: Deprecate using -n and -o together
  2019-08-09  9:11 [Qemu-devel] [PATCH] qemu-img convert: Deprecate using -n and -o together Kevin Wolf
@ 2019-08-09 12:51 ` Max Reitz
  2019-08-09 12:52 ` Eric Blake
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Max Reitz @ 2019-08-09 12:51 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 475 bytes --]

On 09.08.19 11:11, Kevin Wolf wrote:
> 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: Kevin Wolf <kwolf@redhat.com>
> ---
>  qemu-img.c           | 5 +++++
>  qemu-deprecated.texi | 7 +++++++
>  2 files changed, 12 insertions(+)

Reviewed-by: Max Reitz <mreitz@redhat.com>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] qemu-img convert: Deprecate using -n and -o together
  2019-08-09  9:11 [Qemu-devel] [PATCH] qemu-img convert: Deprecate using -n and -o together Kevin Wolf
  2019-08-09 12:51 ` Max Reitz
@ 2019-08-09 12:52 ` Eric Blake
  2019-08-09 23:07 ` [Qemu-devel] [Qemu-block] " Nir Soffer
  2019-08-12 18:47 ` John Snow
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Blake @ 2019-08-09 12:52 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: qemu-devel, mreitz


[-- Attachment #1.1: Type: text/plain, Size: 1201 bytes --]

On 8/9/19 4:11 AM, Kevin Wolf wrote:
> 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: Kevin Wolf <kwolf@redhat.com>
> ---
>  qemu-img.c           | 5 +++++
>  qemu-deprecated.texi | 7 +++++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/qemu-img.c b/qemu-img.c
> index 79983772de..d9321f6418 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -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.");

It looks a bit odd to have two output lines, where one is a phrase and
the other is a full sentence. But I don't have any better ideas how to
represent it, so

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] qemu-img convert: Deprecate using -n and -o together
  2019-08-09  9:11 [Qemu-devel] [PATCH] qemu-img convert: Deprecate using -n and -o together Kevin Wolf
  2019-08-09 12:51 ` Max Reitz
  2019-08-09 12:52 ` Eric Blake
@ 2019-08-09 23:07 ` Nir Soffer
  2019-08-12 18:47 ` John Snow
  3 siblings, 0 replies; 5+ messages in thread
From: Nir Soffer @ 2019-08-09 23:07 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: QEMU Developers, qemu-block, Max Reitz

On Fri, Aug 9, 2019 at 12:11 PM Kevin Wolf <kwolf@redhat.com> wrote:

> 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: Kevin Wolf <kwolf@redhat.com>
> ---
>  qemu-img.c           | 5 +++++
>  qemu-deprecated.texi | 7 +++++++
>  2 files changed, 12 insertions(+)
>
> diff --git a/qemu-img.c b/qemu-img.c
> index 79983772de..d9321f6418 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -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;
>
> diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
> index fff07bb2a3..7673d079c5 100644
> --- a/qemu-deprecated.texi
> +++ b/qemu-deprecated.texi
> @@ -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. This
> +combination never made sense and shows that the user misunderstood the
> +effect of the options, so this will be made an error in future versions.
>

The user misunderstood by not reading qemu code?

Both the online help and the manual page do not mention anything about
that, so I think
they should be fixed to explain the behavior, and this text should mention
that the behavior
was never documented.

Nir


> +
>  @section Build system
>
>  @subsection Python 2 support (since 4.1.0)
> --
> 2.20.1
>
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] qemu-img convert: Deprecate using -n and -o together
  2019-08-09  9:11 [Qemu-devel] [PATCH] qemu-img convert: Deprecate using -n and -o together Kevin Wolf
                   ` (2 preceding siblings ...)
  2019-08-09 23:07 ` [Qemu-devel] [Qemu-block] " Nir Soffer
@ 2019-08-12 18:47 ` John Snow
  3 siblings, 0 replies; 5+ messages in thread
From: John Snow @ 2019-08-12 18:47 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: qemu-devel, mreitz



On 8/9/19 5:11 AM, Kevin Wolf wrote:
> 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: Kevin Wolf <kwolf@redhat.com>
> ---
>  qemu-img.c           | 5 +++++
>  qemu-deprecated.texi | 7 +++++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/qemu-img.c b/qemu-img.c
> index 79983772de..d9321f6418 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -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;
>  
> diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
> index fff07bb2a3..7673d079c5 100644
> --- a/qemu-deprecated.texi
> +++ b/qemu-deprecated.texi
> @@ -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. This
> +combination never made sense and shows that the user misunderstood the
> +effect of the options, so this will be made an error in future versions.
> +

I would avoid too much finger-wagging here. We can just say that the
combination never had a well-defined behavior, so it will now be treated
as an error.

Otherwise:

Reviewed-by: John Snow <jsnow@redhat.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-08-12 18:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-09  9:11 [Qemu-devel] [PATCH] qemu-img convert: Deprecate using -n and -o together Kevin Wolf
2019-08-09 12:51 ` Max Reitz
2019-08-09 12:52 ` Eric Blake
2019-08-09 23:07 ` [Qemu-devel] [Qemu-block] " Nir Soffer
2019-08-12 18:47 ` John Snow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).