|
|
9ae3a8 |
From a20760c046f133055cedaba6952f49758e0d9cbf Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Date: Tue, 25 Feb 2014 15:00:02 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 4/7] qemu-img convert: Support multiple -o options
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1393340405-9936-4-git-send-email-kwolf@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 57799
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.0 qemu-kvm PATCH 3/6] qemu-img convert: Support multiple -o options
|
|
|
9ae3a8 |
Bugzilla: 1065873
|
|
|
9ae3a8 |
RH-Acked-by: Juan Quintela <quintela@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Instead of ignoring all option values but the last one, multiple -o
|
|
|
9ae3a8 |
options now have the same meaning as having a single option with all
|
|
|
9ae3a8 |
settings in the order of their respective -o options.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Jeff Cody <jcody@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 2dc8328b4c6aba60f4ad543186f4e8aec2e9287e)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts:
|
|
|
9ae3a8 |
qemu-img.c
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts because qemu-img convert doesn't have an -l option in RHEL 7.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
qemu-img.c | 31 +++++++++++++++++++++++--------
|
|
|
9ae3a8 |
1 file changed, 23 insertions(+), 8 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
qemu-img.c | 31 +++++++++++++++++++++++--------
|
|
|
9ae3a8 |
1 files changed, 23 insertions(+), 8 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/qemu-img.c b/qemu-img.c
|
|
|
9ae3a8 |
index 12bf996..e7b12c2 100644
|
|
|
9ae3a8 |
--- a/qemu-img.c
|
|
|
9ae3a8 |
+++ b/qemu-img.c
|
|
|
9ae3a8 |
@@ -1159,6 +1159,9 @@ 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 |
@@ -1190,13 +1193,26 @@ static int img_convert(int argc, char **argv)
|
|
|
9ae3a8 |
case 'e':
|
|
|
9ae3a8 |
error_report("option -e is deprecated, please use \'-o "
|
|
|
9ae3a8 |
"encryption\' instead!");
|
|
|
9ae3a8 |
- return 1;
|
|
|
9ae3a8 |
+ ret = -1;
|
|
|
9ae3a8 |
+ goto out;
|
|
|
9ae3a8 |
case '6':
|
|
|
9ae3a8 |
error_report("option -6 is deprecated, please use \'-o "
|
|
|
9ae3a8 |
"compat6\' instead!");
|
|
|
9ae3a8 |
- return 1;
|
|
|
9ae3a8 |
+ ret = -1;
|
|
|
9ae3a8 |
+ goto out;
|
|
|
9ae3a8 |
case 'o':
|
|
|
9ae3a8 |
- options = optarg;
|
|
|
9ae3a8 |
+ if (!is_valid_option_list(optarg)) {
|
|
|
9ae3a8 |
+ error_report("Invalid option list: %s", optarg);
|
|
|
9ae3a8 |
+ ret = -1;
|
|
|
9ae3a8 |
+ goto out;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ if (!options) {
|
|
|
9ae3a8 |
+ options = g_strdup(optarg);
|
|
|
9ae3a8 |
+ } else {
|
|
|
9ae3a8 |
+ char *old_options = options;
|
|
|
9ae3a8 |
+ options = g_strdup_printf("%s,%s", options, optarg);
|
|
|
9ae3a8 |
+ g_free(old_options);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
break;
|
|
|
9ae3a8 |
case 's':
|
|
|
9ae3a8 |
snapshot_name = optarg;
|
|
|
9ae3a8 |
@@ -1208,7 +1224,8 @@ static int img_convert(int argc, char **argv)
|
|
|
9ae3a8 |
sval = strtosz_suffix(optarg, &end, STRTOSZ_DEFSUFFIX_B);
|
|
|
9ae3a8 |
if (sval < 0 || *end) {
|
|
|
9ae3a8 |
error_report("Invalid minimum zero buffer size for sparse output specified");
|
|
|
9ae3a8 |
- return 1;
|
|
|
9ae3a8 |
+ ret = -1;
|
|
|
9ae3a8 |
+ goto out;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
min_sparse = sval / BDRV_SECTOR_SIZE;
|
|
|
9ae3a8 |
@@ -1240,10 +1257,7 @@ static int img_convert(int argc, char **argv)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
out_filename = argv[argc - 1];
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- /* Initialize before goto out */
|
|
|
9ae3a8 |
- qemu_progress_init(progress, 1.0);
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- if (options && is_help_option(options)) {
|
|
|
9ae3a8 |
+ if (options && has_help_option(options)) {
|
|
|
9ae3a8 |
ret = print_block_option_help(out_filename, out_fmt);
|
|
|
9ae3a8 |
goto out;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -1610,6 +1624,7 @@ 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 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|