Skip to contentSkip to conversation

qemu-img: check bs_n when use old style option

PATCH In review [email protected] 2 participants 4 messages Apr 20, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 qemu-img: check bs_n when use old style option

From: Lidong Chen <[email protected]>

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

---
v2 changelog:
avoid duplicating code.

---
 qemu-img.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
qemu-img.c +7 -8
index b220cf7..b4d9255 100644
@@ -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 =
Signature · 1 line
1.8.3.1
#1 lore raw

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

Quoted 49 lines · On Thu, Apr 20, 2017 at 5:19 PM, <[email protected]> wrote:

From: Lidong Chen <[email protected]>

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

---
v2 changelog:
avoid duplicating code.

---
 qemu-img.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
qemu-img.c +7 -9
index b220cf7..b4d9255 100644
@@ -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

#2 lore raw
In reply to [email protected]

Am 20.04.2017 um 11:19 hat [email protected] geschrieben:

Quoted 6 lines

From: Lidong Chen <[email protected]>

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

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

#3 lore raw
Quoted 10 lines · Kevin Wolf

Am 20.04.2017 um 11:19 hat [email protected] geschrieben:

Quoted 6 lines

From: Lidong Chen <[email protected]>

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

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.

Quoted 4 lines

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

Kevin