All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] qemu-img: check bs_n when use old style option
@ 2017-04-20  9:19 jemmy858585
  2017-04-20  9:28 ` 858585 jemmy
  2017-04-20  9:33 ` Kevin Wolf
  0 siblings, 2 replies; 4+ messages in thread
From: jemmy858585 @ 2017-04-20  9:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, mreitz, qemu-block, Lidong Chen

From: Lidong Chen <lidongchen@tencent.com>

When use old style option like -o backing_file, img_convert
continue run when bs_n > 1, this patch fix this bug.

Signed-off-by: Lidong Chen <lidongchen@tencent.com>
---
v2 changelog:
    avoid duplicating code.
---
 qemu-img.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index b220cf7..b4d9255 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2108,14 +2108,6 @@ static int img_convert(int argc, char **argv)
         error_exit("Must specify image file name");
     }
 
-
-    if (bs_n > 1 && out_baseimg) {
-        error_report("-B makes no sense when concatenating multiple input "
-                     "images");
-        ret = -1;
-        goto out;
-    }
-
     src_flags = 0;
     ret = bdrv_parse_cache_mode(src_cache, &src_flags, &src_writethrough);
     if (ret < 0) {
@@ -2225,6 +2217,13 @@ static int img_convert(int argc, char **argv)
         out_baseimg = out_baseimg_param;
     }
 
+    if (bs_n > 1 && out_baseimg) {
+        error_report("Specifying backing image makes no sense when "
+                     "concatenating multiple input images");
+        ret = -1;
+        goto out;
+    }
+
     /* Check if compression is supported */
     if (compress) {
         bool encryption =
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH v2] qemu-img: check bs_n when use old style option
  2017-04-20  9:19 [Qemu-devel] [PATCH v2] qemu-img: check bs_n when use old style option jemmy858585
@ 2017-04-20  9:28 ` 858585 jemmy
  2017-04-20  9:33 ` Kevin Wolf
  1 sibling, 0 replies; 4+ messages in thread
From: 858585 jemmy @ 2017-04-20  9:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, mreitz, qemu block, Lidong Chen

test result for this patch:
qemu-img convert -c -p -o
backing_file=/baseimage/img2015122818606660/img2015122818606660.qcow2
-O qcow2 /data/img2017041611162809.qcow2
/data/img2017041611162809.qcow2 /mnt/img2017041611162809_zip_new.qcow2
qemu-img: Specifying backing image makes no sense when concatenating
multiple input images

qemu-img convert -c -p -B
baseimage/img2015122818606660/img2015122818606660.qcow2 -O qcow2
/data/img2017041611162809.qcow2 /data/img2017041611162809.qcow2
/mnt/img2017041611162809_zip_new.qcow2
qemu-img: Specifying backing image makes no sense when concatenating
multiple input images


On Thu, Apr 20, 2017 at 5:19 PM,  <jemmy858585@gmail.com> wrote:
> From: Lidong Chen <lidongchen@tencent.com>
>
> When use old style option like -o backing_file, img_convert
> continue run when bs_n > 1, this patch fix this bug.
>
> Signed-off-by: Lidong Chen <lidongchen@tencent.com>
> ---
> v2 changelog:
>     avoid duplicating code.
> ---
>  qemu-img.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/qemu-img.c b/qemu-img.c
> index b220cf7..b4d9255 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -2108,14 +2108,6 @@ static int img_convert(int argc, char **argv)
>          error_exit("Must specify image file name");
>      }
>
> -
> -    if (bs_n > 1 && out_baseimg) {
> -        error_report("-B makes no sense when concatenating multiple input "
> -                     "images");
> -        ret = -1;
> -        goto out;
> -    }
> -
>      src_flags = 0;
>      ret = bdrv_parse_cache_mode(src_cache, &src_flags, &src_writethrough);
>      if (ret < 0) {
> @@ -2225,6 +2217,13 @@ static int img_convert(int argc, char **argv)
>          out_baseimg = out_baseimg_param;
>      }
>
> +    if (bs_n > 1 && out_baseimg) {
> +        error_report("Specifying backing image makes no sense when "
> +                     "concatenating multiple input images");
> +        ret = -1;
> +        goto out;
> +    }
> +
>      /* Check if compression is supported */
>      if (compress) {
>          bool encryption =
> --
> 1.8.3.1
>

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

* Re: [Qemu-devel] [PATCH v2] qemu-img: check bs_n when use old style option
  2017-04-20  9:19 [Qemu-devel] [PATCH v2] qemu-img: check bs_n when use old style option jemmy858585
  2017-04-20  9:28 ` 858585 jemmy
@ 2017-04-20  9:33 ` Kevin Wolf
  2017-04-20  9:38   ` 858585 jemmy
  1 sibling, 1 reply; 4+ messages in thread
From: Kevin Wolf @ 2017-04-20  9:33 UTC (permalink / raw)
  To: jemmy858585; +Cc: qemu-devel, mreitz, qemu-block, Lidong Chen

Am 20.04.2017 um 11:19 hat jemmy858585@gmail.com geschrieben:
> From: Lidong Chen <lidongchen@tencent.com>
> 
> When use old style option like -o backing_file, img_convert
> continue run when bs_n > 1, this patch fix this bug.
> 
> Signed-off-by: Lidong Chen <lidongchen@tencent.com>

I think this is a duplicate of Max' "[PATCH for-2.10 3/3]
qemu-img/convert: Move bs_n > 1 && -B check down".

Also, -B is the old-style option, not -o backing_file.

Kevin

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

* Re: [Qemu-devel] [PATCH v2] qemu-img: check bs_n when use old style option
  2017-04-20  9:33 ` Kevin Wolf
@ 2017-04-20  9:38   ` 858585 jemmy
  0 siblings, 0 replies; 4+ messages in thread
From: 858585 jemmy @ 2017-04-20  9:38 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel, mreitz, qemu block, Lidong Chen

On Thu, Apr 20, 2017 at 5:33 PM, Kevin Wolf <kwolf@redhat.com> wrote:
> Am 20.04.2017 um 11:19 hat jemmy858585@gmail.com geschrieben:
>> From: Lidong Chen <lidongchen@tencent.com>
>>
>> When use old style option like -o backing_file, img_convert
>> continue run when bs_n > 1, this patch fix this bug.
>>
>> Signed-off-by: Lidong Chen <lidongchen@tencent.com>
>
> I think this is a duplicate of Max' "[PATCH for-2.10 3/3]
> qemu-img/convert: Move bs_n > 1 && -B check down".
ok, thanks.

>
> Also, -B is the old-style option, not -o backing_file.
>
> Kevin

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

end of thread, other threads:[~2017-04-20  9:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-20  9:19 [Qemu-devel] [PATCH v2] qemu-img: check bs_n when use old style option jemmy858585
2017-04-20  9:28 ` 858585 jemmy
2017-04-20  9:33 ` Kevin Wolf
2017-04-20  9:38   ` 858585 jemmy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.