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