cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
0a122b
From b099e03cdfbf175bf8b2368b83348ca2359004c7 Mon Sep 17 00:00:00 2001
0a122b
From: Kevin Wolf <kwolf@redhat.com>
0a122b
Date: Mon, 10 Mar 2014 10:33:22 +0100
0a122b
Subject: [PATCH 11/16] qemu-img convert: Fix progress output
0a122b
0a122b
RH-Author: Kevin Wolf <kwolf@redhat.com>
0a122b
Message-id: <1394447603-30527-2-git-send-email-kwolf@redhat.com>
0a122b
Patchwork-id: 58060
0a122b
O-Subject: [RHEL-7.0 qemu-kvm PATCH 1/2] qemu-img convert: Fix progress output
0a122b
Bugzilla: 1073728
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
RH-Acked-by: Max Reitz <mreitz@redhat.com>
0a122b
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
0a122b
Initialise progress output only when the -p and -q options have already
0a122b
been parsed, otherwise it's always disabled.
0a122b
0a122b
Reported-by: Peter Lieven <pl@kamp.de>
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
Reviewed-by: Eric Blake <eblake@redhat.com>
0a122b
(cherry picked from commit 64bb01aa35a24bea7ad0a1a8713991bab5020d12)
0a122b
0a122b
Conflicts:
0a122b
	qemu-img.c
0a122b
0a122b
Conflicts because RHEL 7 doesn't support -l in qemu-img convert.
0a122b
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
---
0a122b
 qemu-img.c | 18 ++++++++++--------
0a122b
 1 file changed, 10 insertions(+), 8 deletions(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 qemu-img.c |   18 ++++++++++--------
0a122b
 1 files changed, 10 insertions(+), 8 deletions(-)
0a122b
0a122b
diff --git a/qemu-img.c b/qemu-img.c
0a122b
index 3dc325e..dcce380 100644
0a122b
--- a/qemu-img.c
0a122b
+++ b/qemu-img.c
0a122b
@@ -1163,9 +1163,6 @@ static int img_convert(int argc, char **argv)
0a122b
     bool quiet = false;
0a122b
     Error *local_err = NULL;
0a122b
 
0a122b
-    /* Initialize before goto out */
0a122b
-    qemu_progress_init(progress, 1.0);
0a122b
-
0a122b
     fmt = NULL;
0a122b
     out_fmt = "raw";
0a122b
     cache = "unsafe";
0a122b
@@ -1198,17 +1195,17 @@ static int img_convert(int argc, char **argv)
0a122b
             error_report("option -e is deprecated, please use \'-o "
0a122b
                   "encryption\' instead!");
0a122b
             ret = -1;
0a122b
-            goto out;
0a122b
+            goto fail_getopt;
0a122b
         case '6':
0a122b
             error_report("option -6 is deprecated, please use \'-o "
0a122b
                   "compat6\' instead!");
0a122b
             ret = -1;
0a122b
-            goto out;
0a122b
+            goto fail_getopt;
0a122b
         case 'o':
0a122b
             if (!is_valid_option_list(optarg)) {
0a122b
                 error_report("Invalid option list: %s", optarg);
0a122b
                 ret = -1;
0a122b
-                goto out;
0a122b
+                goto fail_getopt;
0a122b
             }
0a122b
             if (!options) {
0a122b
                 options = g_strdup(optarg);
0a122b
@@ -1229,7 +1226,7 @@ static int img_convert(int argc, char **argv)
0a122b
             if (sval < 0 || *end) {
0a122b
                 error_report("Invalid minimum zero buffer size for sparse output specified");
0a122b
                 ret = -1;
0a122b
-                goto out;
0a122b
+                goto fail_getopt;
0a122b
             }
0a122b
 
0a122b
             min_sparse = sval / BDRV_SECTOR_SIZE;
0a122b
@@ -1250,9 +1247,12 @@ static int img_convert(int argc, char **argv)
0a122b
         }
0a122b
     }
0a122b
 
0a122b
+    /* Initialize before goto out */
0a122b
     if (quiet) {
0a122b
         progress = 0;
0a122b
     }
0a122b
+    qemu_progress_init(progress, 1.0);
0a122b
+
0a122b
 
0a122b
     bs_n = argc - optind - 1;
0a122b
     out_filename = bs_n >= 1 ? argv[argc - 1] : NULL;
0a122b
@@ -1629,7 +1629,6 @@ out:
0a122b
     free_option_parameters(create_options);
0a122b
     free_option_parameters(param);
0a122b
     qemu_vfree(buf);
0a122b
-    g_free(options);
0a122b
     if (out_bs) {
0a122b
         bdrv_unref(out_bs);
0a122b
     }
0a122b
@@ -1641,6 +1640,9 @@ out:
0a122b
         }
0a122b
         g_free(bs);
0a122b
     }
0a122b
+fail_getopt:
0a122b
+    g_free(options);
0a122b
+
0a122b
     if (ret) {
0a122b
         return 1;
0a122b
     }
0a122b
-- 
0a122b
1.7.1
0a122b